home *** CD-ROM | disk | FTP | other *** search
/ Scene Storm / Scene Storm - Volume 1.iso / coding / tools / gcc / libnixv1_0.lha / gnu / libnix-sources.lha next >
LHArc Archive  |  1995-07-13  |  308.0 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LHArc Archive (archive/lha).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LHArc Archive (archive/lha) magic Supported
100% file LHarc 1.x/ARX archive data [lh0], with "libnix.texi" default
99% file data default
100% TrID LHARC/LZARK compressed archive (generic) default
100% siegfried fmt/626 LHA File Format default
100% lsar LZH default
100% gt2 LZH Archiv gefunden (Auflistung ist deaktiviert) default
100% detectItEasy Archive: LHA archive (.LHA)(-lh0-) default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 21 e7 2d 6c 68 30 2d 7b | c2 00 00 7b c2 00 00 42 |!.-lh0-{|...{...B|
|00000010| 86 ec 1e 02 00 0b 6c 69 | 62 6e 69 78 2e 74 65 78 |......li|bnix.tex|
|00000020| 69 88 3a 5c 69 6e 70 75 | 74 20 74 65 78 69 6e 66 |i.:\inpu|t texinf|
|00000030| 6f 0a 40 73 65 74 66 69 | 6c 65 6e 61 6d 65 20 6c |o.@setfi|lename l|
|00000040| 69 62 6e 69 78 2e 69 6e | 66 6f 0a 40 73 65 74 74 |ibnix.in|fo.@sett|
|00000050| 69 74 6c 65 20 6c 69 62 | 6e 69 78 20 2d 20 61 20 |itle lib|nix - a |
|00000060| 73 74 61 74 69 63 20 6c | 69 62 72 61 72 79 20 66 |static l|ibrary f|
|00000070| 6f 72 20 47 43 43 20 6f | 6e 20 74 68 65 20 61 6d |or GCC o|n the am|
|00000080| 69 67 61 0a 40 73 65 74 | 63 68 61 70 74 65 72 6e |iga.@set|chaptern|
|00000090| 65 77 70 61 67 65 20 6f | 64 64 0a 0a 40 69 66 69 |ewpage o|dd..@ifi|
|000000a0| 6e 66 6f 0a 54 68 69 73 | 20 69 73 20 6c 69 62 6e |nfo.This| is libn|
|000000b0| 69 78 2e 74 65 78 69 20 | 74 68 65 20 64 6f 63 75 |ix.texi |the docu|
|000000c0| 6d 65 6e 74 61 74 69 6f | 6e 20 6f 66 20 74 68 65 |mentatio|n of the|
|000000d0| 20 6c 69 62 6e 69 78 20 | 6c 69 62 72 61 72 79 2e | libnix |library.|
|000000e0| 0a 53 69 6e 63 65 20 74 | 68 69 73 20 64 6f 63 75 |.Since t|his docu|
|000000f0| 6d 65 6e 74 20 69 73 20 | 70 61 72 74 20 6f 66 20 |ment is |part of |
|00000100| 74 68 65 20 6c 69 62 6e | 69 78 20 70 61 63 6b 61 |the libn|ix packa|
|00000110| 67 65 20 69 74 20 73 74 | 61 6e 64 73 0a 75 6e 64 |ge it st|ands.und|
|00000120| 65 72 20 74 68 65 20 73 | 61 6d 65 20 63 6f 70 79 |er the s|ame copy|
|00000130| 72 69 67 68 74 20 61 73 | 20 74 68 65 20 6c 69 62 |right as| the lib|
|00000140| 72 61 72 79 20 69 74 73 | 65 6c 66 2c 20 69 2e 65 |rary its|elf, i.e|
|00000150| 2e 20 69 74 27 73 20 0a | 70 75 62 6c 69 63 20 64 |. it's .|public d|
|00000160| 6f 6d 61 69 6e 2e 0a 40 | 65 6e 64 20 69 66 69 6e |omain..@|end ifin|
|00000170| 66 6f 0a 40 74 69 74 6c | 65 70 61 67 65 0a 40 74 |fo.@titl|epage.@t|
|00000180| 69 74 6c 65 20 6c 69 62 | 6e 69 78 0a 40 73 75 62 |itle lib|nix.@sub|
|00000190| 74 69 74 6c 65 20 61 20 | 73 74 61 74 69 63 20 6c |title a |static l|
|000001a0| 69 62 72 61 72 79 20 66 | 6f 72 20 47 43 43 20 6f |ibrary f|or GCC o|
|000001b0| 6e 20 74 68 65 20 61 6d | 69 67 61 0a 40 61 75 74 |n the am|iga.@aut|
|000001c0| 68 6f 72 20 4d 61 74 74 | 68 69 61 73 20 46 6c 65 |hor Matt|hias Fle|
|000001d0| 69 73 63 68 65 72 20 26 | 20 47 75 6e 74 68 65 72 |ischer &| Gunther|
|000001e0| 20 4e 69 6b 6c 0a 40 65 | 6e 64 20 74 69 74 6c 65 | Nikl.@e|nd title|
|000001f0| 70 61 67 65 0a 0a 40 6e | 6f 64 65 20 54 6f 70 2c |page..@n|ode Top,|
|00000200| 44 65 73 63 72 69 70 74 | 69 6f 6e 2c 28 64 69 72 |Descript|ion,(dir|
|00000210| 29 2c 28 64 69 72 29 0a | 40 69 66 69 6e 66 6f 0a |),(dir).|@ifinfo.|
|00000220| 54 68 69 73 20 69 73 20 | 74 68 65 20 64 6f 63 75 |This is |the docu|
|00000230| 6d 65 6e 74 61 74 69 6f | 6e 20 6f 66 20 6c 69 62 |mentatio|n of lib|
|00000240| 6e 69 78 2e 20 54 68 65 | 20 66 6f 6c 6c 6f 77 69 |nix. The| followi|
|00000250| 6e 67 20 69 73 20 61 20 | 6c 69 73 74 0a 6f 66 20 |ng is a |list.of |
|00000260| 63 68 61 70 74 65 72 73 | 2e 20 59 6f 75 20 6e 65 |chapters|. You ne|
|00000270| 65 64 20 6e 6f 74 20 72 | 65 61 64 20 61 6c 6c 20 |ed not r|ead all |
|00000280| 6f 66 20 74 68 65 6d 20 | 2d 20 62 75 74 20 72 65 |of them |- but re|
|00000290| 61 64 69 6e 67 0a 74 68 | 65 20 63 68 61 70 74 65 |ading.th|e chapte|
|000002a0| 72 20 46 65 61 74 75 72 | 65 73 20 69 73 20 72 65 |r Featur|es is re|
|000002b0| 63 6f 6d 6d 65 6e 64 65 | 64 2e 0a 40 65 6e 64 20 |commende|d..@end |
|000002c0| 69 66 69 6e 66 6f 0a 0a | 40 6d 65 6e 75 0a 2a 20 |ifinfo..|@menu.* |
|000002d0| 44 65 73 63 72 69 70 74 | 69 6f 6e 3a 3a 20 20 20 |Descript|ion:: |
|000002e0| 20 20 20 57 68 61 74 20 | 69 73 20 6c 69 62 6e 69 | What |is libni|
|000002f0| 78 3f 0a 2a 20 41 75 74 | 68 6f 72 73 3a 3a 20 20 |x?.* Aut|hors:: |
|00000300| 20 20 20 20 20 20 20 20 | 57 68 6f 20 64 69 64 20 | |Who did |
|00000310| 69 74 3f 0a 2a 20 44 69 | 73 63 6c 61 69 6d 65 72 |it?.* Di|sclaimer|
|00000320| 3a 3a 20 20 20 20 20 20 | 20 43 6f 70 79 72 69 67 |:: | Copyrig|
|00000330| 68 74 20 61 6e 64 20 6f | 74 68 65 72 20 6c 65 67 |ht and o|ther leg|
|00000340| 61 6c 20 73 74 75 66 66 | 2e 0a 2a 20 4e 61 6d 69 |al stuff|..* Nami|
|00000350| 6e 67 3a 3a 20 20 20 20 | 20 20 20 20 20 20 20 4e |ng:: | N|
|00000360| 61 6d 69 6e 67 20 63 6f | 6e 76 65 6e 74 69 6f 6e |aming co|nvention|
|00000370| 73 2e 0a 2a 20 55 73 61 | 67 65 3a 3a 20 20 20 20 |s..* Usa|ge:: |
|00000380| 20 20 20 20 20 20 20 20 | 48 6f 77 20 74 6f 20 75 | |How to u|
|00000390| 73 65 20 69 74 20 3b 2d | 29 0a 2a 20 46 65 61 74 |se it ;-|).* Feat|
|000003a0| 75 72 65 73 3a 3a 20 20 | 20 20 20 20 20 20 20 44 |ures:: | D|
|000003b0| 65 74 61 69 6c 73 20 6f | 66 20 74 68 65 20 69 6d |etails o|f the im|
|000003c0| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 20 28 61 6e |plementa|tion (an|
|000003d0| 64 20 6d 6f 72 65 29 2e | 0a 2a 20 53 70 65 63 69 |d more).|.* Speci|
|000003e0| 61 6c 20 73 74 61 72 74 | 75 70 73 3a 3a 20 48 6f |al start|ups:: Ho|
|000003f0| 77 20 74 6f 20 77 72 69 | 74 65 20 73 68 61 72 65 |w to wri|te share|
|00000400| 64 20 6c 69 62 72 61 72 | 69 65 73 20 61 6e 64 20 |d librar|ies and |
|00000410| 64 65 76 69 63 65 73 20 | 77 69 74 68 20 67 63 63 |devices |with gcc|
|00000420| 2e 0a 2a 20 53 65 74 20 | 65 6c 65 6d 65 6e 74 73 |..* Set |elements|
|00000430| 3a 3a 20 20 20 20 20 41 | 20 6e 69 63 65 20 66 65 |:: A| nice fe|
|00000440| 61 74 75 72 65 20 6f 66 | 20 67 6e 75 20 6c 64 2e |ature of| gnu ld.|
|00000450| 0a 2a 20 4c 69 62 72 61 | 72 79 20 62 61 73 65 73 |.* Libra|ry bases|
|00000460| 3a 3a 20 20 20 20 41 6e | 64 20 68 6f 77 20 74 68 |:: An|d how th|
|00000470| 65 79 20 77 6f 72 6b 2e | 0a 2a 20 67 65 74 61 34 |ey work.|.* geta4|
|00000480| 3a 3a 20 20 20 20 20 20 | 20 20 20 20 20 20 53 6f |:: | So|
|00000490| 6d 65 20 77 6f 72 64 73 | 20 6f 6e 20 63 6f 64 65 |me words| on code|
|000004a0| 20 61 6e 64 20 64 61 74 | 61 20 6d 6f 64 65 6c 73 | and dat|a models|
|000004b0| 0a 2a 20 46 41 51 73 3a | 3a 20 20 20 20 20 20 20 |.* FAQs:|: |
|000004c0| 20 20 20 20 20 20 46 72 | 65 71 75 65 6e 74 6c 79 | Fr|equently|
|000004d0| 20 61 73 6b 65 64 20 71 | 75 65 73 74 69 6f 6e 73 | asked q|uestions|
|000004e0| 20 61 6e 64 20 61 6e 73 | 77 65 72 73 2e 0a 40 65 | and ans|wers..@e|
|000004f0| 6e 64 20 6d 65 6e 75 0a | 40 6e 6f 64 65 20 44 65 |nd menu.|@node De|
|00000500| 73 63 72 69 70 74 69 6f | 6e 2c 41 75 74 68 6f 72 |scriptio|n,Author|
|00000510| 73 2c 54 6f 70 2c 54 6f | 70 0a 40 63 68 61 70 74 |s,Top,To|p.@chapt|
|00000520| 65 72 20 57 68 61 74 20 | 69 73 20 6c 69 62 6e 69 |er What |is libni|
|00000530| 78 3f 0a 0a 6c 69 62 6e | 69 78 20 69 73 20 61 20 |x?..libn|ix is a |
|00000540| 73 74 61 74 69 63 20 28 | 69 2e 65 2e 20 6c 69 6e |static (|i.e. lin|
|00000550| 6b 29 20 6c 69 62 72 61 | 72 79 20 66 6f 72 20 75 |k) libra|ry for u|
|00000560| 73 61 67 65 20 6f 6e 20 | 61 6d 69 67 61 20 63 6f |sage on |amiga co|
|00000570| 6d 70 75 74 65 72 73 0a | 74 6f 67 65 74 68 65 72 |mputers.|together|
|00000580| 20 77 69 74 68 20 67 63 | 63 20 32 2e 33 2e 33 20 | with gc|c 2.3.3 |
|00000590| 6f 72 20 61 62 6f 76 65 | 2e 20 49 74 20 69 73 20 |or above|. It is |
|000005a0| 76 65 72 79 20 61 6d 69 | 67 61 6c 69 6b 65 20 61 |very ami|galike a|
|000005b0| 6e 64 20 63 6f 6e 74 61 | 69 6e 73 0a 61 20 6c 6f |nd conta|ins.a lo|
|000005c0| 74 20 6f 66 20 66 65 61 | 74 75 72 65 73 20 79 6f |t of fea|tures yo|
|000005d0| 75 20 70 72 6f 62 61 62 | 6c 79 20 64 6f 6e 27 74 |u probab|ly don't|
|000005e0| 20 77 61 6e 74 20 74 6f | 20 6d 69 73 73 3a 0a 0a | want to| miss:..|
|000005f0| 40 69 74 65 6d 69 7a 65 | 20 40 62 75 6c 6c 65 74 |@itemize| @bullet|
|00000600| 0a 40 69 74 65 6d 0a 61 | 75 74 6f 2d 6f 70 65 6e |.@item.a|uto-open|
|00000610| 2d 6c 69 62 72 61 72 79 | 20 66 65 61 74 75 72 65 |-library| feature|
|00000620| 0a 40 69 74 65 6d 0a 53 | 41 53 20 63 6f 6d 70 61 |.@item.S|AS compa|
|00000630| 74 69 62 6c 65 20 68 61 | 6e 64 6c 69 6e 67 20 6f |tible ha|ndling o|
|00000640| 66 20 57 42 20 73 74 61 | 72 74 75 70 20 6d 65 73 |f WB sta|rtup mes|
|00000650| 73 61 67 65 0a 40 69 74 | 65 6d 0a 61 75 74 6f 2d |sage.@it|em.auto-|
|00000660| 64 65 74 61 63 68 20 73 | 74 61 72 74 75 70 20 63 |detach s|tartup c|
|00000670| 6f 64 65 0a 40 69 74 65 | 6d 0a 69 73 20 76 65 72 |ode.@ite|m.is ver|
|00000680| 79 20 73 68 6f 72 74 0a | 40 69 74 65 6d 0a 64 6f |y short.|@item.do|
|00000690| 65 73 20 6e 6f 74 20 72 | 65 71 75 69 72 65 20 61 |es not r|equire a|
|000006a0| 20 73 68 61 72 65 64 20 | 6c 69 62 72 61 72 79 0a | shared |library.|
|000006b0| 40 69 74 65 6d 0a 61 75 | 74 6f 20 73 74 61 63 6b |@item.au|to stack|
|000006c0| 2d 65 78 74 65 6e 64 0a | 40 69 74 65 6d 0a 61 6e |-extend.|@item.an|
|000006d0| 64 20 6d 75 63 68 20 6d | 6f 72 65 0a 40 65 6e 64 |d much m|ore.@end|
|000006e0| 20 69 74 65 6d 69 7a 65 | 0a 0a 53 6f 20 69 66 20 | itemize|..So if |
|000006f0| 79 6f 75 20 77 61 6e 74 | 20 74 6f 20 77 72 69 74 |you want| to writ|
|00000700| 65 20 61 6d 69 67 61 20 | 73 70 65 63 69 66 69 63 |e amiga |specific|
|00000710| 20 70 72 6f 67 72 61 6d | 73 20 6f 72 20 69 66 20 | program|s or if |
|00000720| 79 6f 75 20 6f 6e 6c 79 | 20 6e 65 65 64 20 41 4e |you only| need AN|
|00000730| 53 49 20 73 75 70 70 6f | 72 74 0a 69 6e 73 74 65 |SI suppo|rt.inste|
|00000740| 61 64 20 6f 66 20 75 6e | 69 78 20 63 6f 6d 70 61 |ad of un|ix compa|
|00000750| 74 69 62 69 6c 69 74 79 | 20 2d 20 61 6e 64 20 69 |tibility| - and i|
|00000760| 66 20 79 6f 75 20 64 6f | 6e 27 74 20 77 61 6e 74 |f you do|n't want|
|00000770| 20 74 6f 20 72 65 64 69 | 73 74 72 69 62 75 74 65 | to redi|stribute|
|00000780| 20 69 78 65 6d 75 6c 2e | 6c 69 62 72 61 72 79 20 | ixemul.|library |
|00000790| 2d 0a 74 68 69 73 20 63 | 61 6e 20 62 65 20 79 6f |-.this c|an be yo|
|000007a0| 75 72 20 63 68 6f 69 63 | 65 2e 0a 0a 42 75 74 20 |ur choic|e...But |
|000007b0| 62 65 20 61 77 61 72 65 | 20 2d 20 6c 69 62 6e 69 |be aware| - libni|
|000007c0| 78 20 72 65 71 75 69 72 | 65 73 20 41 6d 69 67 61 |x requir|es Amiga|
|000007d0| 20 4f 53 20 32 2e 30 20 | 6f 72 20 68 69 67 68 65 | OS 2.0 |or highe|
|000007e0| 72 20 3a 28 2e 0a 0a 40 | 6e 6f 64 65 20 41 75 74 |r :(...@|node Aut|
|000007f0| 68 6f 72 73 2c 44 69 73 | 63 6c 61 69 6d 65 72 2c |hors,Dis|claimer,|
|00000800| 44 65 73 63 72 69 70 74 | 69 6f 6e 2c 54 6f 70 0a |Descript|ion,Top.|
|00000810| 40 63 68 61 70 74 65 72 | 20 41 75 74 68 6f 72 73 |@chapter| Authors|
|00000820| 0a 0a 49 66 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |..If you| want to|
|00000830| 20 63 68 61 6e 67 65 20 | 61 6e 79 74 68 69 6e 67 | change |anything|
|00000840| 20 69 6e 20 74 68 65 20 | 6c 69 62 72 61 72 79 20 | in the |library |
|00000850| 70 6c 65 61 73 65 20 63 | 6f 6e 74 61 63 74 20 6f |please c|ontact o|
|00000860| 6e 65 20 6f 66 20 75 73 | 20 66 69 72 73 74 20 2d |ne of us| first -|
|00000870| 20 0a 77 65 20 6b 6e 6f | 77 20 68 6f 77 20 74 6f | .we kno|w how to|
|00000880| 20 64 6f 20 69 74 20 62 | 65 73 74 20 73 69 6e 63 | do it b|est sinc|
|00000890| 65 20 77 65 20 77 72 6f | 74 65 20 69 74 2e 20 49 |e we wro|te it. I|
|000008a0| 66 20 79 6f 75 20 77 61 | 6e 74 20 74 6f 20 72 65 |f you wa|nt to re|
|000008b0| 70 6f 72 74 0a 62 75 67 | 73 20 70 6c 65 61 73 65 |port.bug|s please|
|000008c0| 20 63 6f 6e 74 61 63 74 | 20 75 73 2c 20 74 6f 6f | contact| us, too|
|000008d0| 2e 20 49 66 20 77 65 20 | 64 6f 6e 27 74 20 6b 6e |. If we |don't kn|
|000008e0| 6f 77 20 61 62 6f 75 74 | 20 74 68 65 6d 20 77 65 |ow about| them we|
|000008f0| 20 63 61 6e 6e 6f 74 20 | 66 69 78 20 74 68 65 6d | cannot |fix them|
|00000900| 2e 0a 0a 4d 61 74 74 68 | 69 61 73 20 46 6c 65 69 |...Matth|ias Flei|
|00000910| 73 63 68 65 72 0a 40 2a | 66 6c 65 69 73 63 68 72 |scher.@*|fleischr|
|00000920| 40 40 69 7a 66 6d 2e 75 | 6e 69 2d 73 74 75 74 74 |@@izfm.u|ni-stutt|
|00000930| 67 61 72 74 2e 64 65 0a | 0a 47 75 6e 74 68 65 72 |gart.de.|.Gunther|
|00000940| 20 4e 69 6b 6c 0a 40 2a | 67 6e 69 6b 6c 40 40 69 | Nikl.@*|gnikl@@i|
|00000950| 6e 66 6f 72 6d 61 74 69 | 6b 2e 75 6e 69 2d 72 6f |nformati|k.uni-ro|
|00000960| 73 74 6f 63 6b 2e 64 65 | 0a 0a 49 20 77 61 6e 74 |stock.de|..I want|
|00000970| 20 74 6f 20 74 68 61 6e | 6b 20 65 73 70 65 63 69 | to than|k especi|
|00000980| 61 6c 6c 79 20 47 65 72 | 68 61 72 64 20 4d fc 6c |ally Ger|hard M.l|
|00000990| 6c 65 72 20 28 74 68 65 | 20 61 75 74 68 6f 72 20 |ler (the| author |
|000009a0| 6f 66 20 67 65 72 6c 69 | 62 29 20 2d 20 77 65 20 |of gerli|b) - we |
|000009b0| 77 6f 72 6b 65 64 0a 68 | 61 72 64 20 74 6f 67 65 |worked.h|ard toge|
|000009c0| 74 68 65 72 20 74 6f 20 | 62 65 20 63 6f 6d 70 61 |ther to |be compa|
|000009d0| 74 69 62 6c 65 20 2d 20 | 6a 75 73 74 20 77 61 69 |tible - |just wai|
|000009e0| 74 20 66 6f 72 20 68 69 | 73 20 6e 65 78 74 20 72 |t for hi|s next r|
|000009f0| 65 6c 65 61 73 65 2e 0a | 41 6e 64 20 50 68 69 6c |elease..|And Phil|
|00000a00| 69 70 70 65 20 42 72 61 | 6e 64 20 2d 20 74 68 65 |ippe Bra|nd - the|
|00000a10| 20 6e 61 6d 65 20 6c 69 | 62 6e 69 78 20 77 61 73 | name li|bnix was|
|00000a20| 20 68 69 73 20 69 64 65 | 61 2e 0a 0a 40 6e 6f 64 | his ide|a...@nod|
|00000a30| 65 20 44 69 73 63 6c 61 | 69 6d 65 72 2c 4e 61 6d |e Discla|imer,Nam|
|00000a40| 69 6e 67 2c 41 75 74 68 | 6f 72 73 2c 54 6f 70 0a |ing,Auth|ors,Top.|
|00000a50| 40 63 68 61 70 74 65 72 | 20 44 69 73 63 6c 61 69 |@chapter| Disclai|
|00000a60| 6d 65 72 0a 0a 54 68 69 | 73 20 70 61 63 6b 61 67 |mer..Thi|s packag|
|00000a70| 65 20 69 73 20 70 75 62 | 6c 69 63 20 64 6f 6d 61 |e is pub|lic doma|
|00000a80| 69 6e 2e 20 54 68 61 74 | 20 6d 65 61 6e 73 20 74 |in. That| means t|
|00000a90| 68 61 74 20 79 6f 75 20 | 63 61 6e 20 63 6f 70 79 |hat you |can copy|
|00000aa0| 2c 20 75 73 65 20 61 6e | 64 20 6d 6f 64 69 66 79 |, use an|d modify|
|00000ab0| 20 69 74 0a 77 69 74 68 | 6f 75 74 20 61 6e 79 20 | it.with|out any |
|00000ac0| 70 72 6f 62 6c 65 6d 73 | 20 61 6e 64 20 74 68 61 |problems| and tha|
|00000ad0| 74 20 79 6f 75 20 63 61 | 6e 20 67 65 74 20 69 74 |t you ca|n get it|
|00000ae0| 20 66 6f 72 20 66 72 65 | 65 2e 20 49 66 20 79 6f | for fre|e. If yo|
|00000af0| 75 20 61 63 74 75 61 6c | 6c 79 0a 70 61 69 64 20 |u actual|ly.paid |
|00000b00| 66 6f 72 20 67 65 74 74 | 69 6e 67 20 69 74 20 74 |for gett|ing it t|
|00000b10| 68 69 73 20 69 73 20 63 | 6f 6d 70 6c 65 74 65 6c |his is c|ompletel|
|00000b20| 79 20 79 6f 75 72 20 66 | 61 75 6c 74 20 2d 20 49 |y your f|ault - I|
|00000b30| 20 64 69 64 6e 27 74 20 | 73 65 65 20 61 20 63 65 | didn't |see a ce|
|00000b40| 6e 74 0a 6f 66 20 74 68 | 61 74 20 6d 6f 6e 65 79 |nt.of th|at money|
|00000b50| 2e 20 49 74 20 61 6c 73 | 6f 20 6d 65 61 6e 73 20 |. It als|o means |
|00000b60| 74 68 61 74 20 49 20 63 | 61 6e 6e 6f 74 20 62 65 |that I c|annot be|
|00000b70| 20 6d 61 64 65 20 72 65 | 73 70 6f 6e 73 69 62 6c | made re|sponsibl|
|00000b80| 65 20 66 6f 72 20 61 6e | 79 20 64 61 6d 61 67 65 |e for an|y damage|
|00000b90| 0a 72 65 73 75 6c 74 69 | 6e 67 20 6f 75 74 20 6f |.resulti|ng out o|
|00000ba0| 66 20 74 68 65 20 75 73 | 65 20 6f 66 20 69 74 20 |f the us|e of it |
|00000bb0| 2d 20 79 6f 75 20 73 69 | 6d 70 6c 79 20 73 68 6f |- you si|mply sho|
|00000bc0| 75 6c 64 6e 27 74 20 74 | 72 75 73 74 20 61 6e 79 |uldn't t|rust any|
|00000bd0| 74 68 69 6e 67 20 79 6f | 75 20 64 69 64 6e 27 74 |thing yo|u didn't|
|00000be0| 0a 70 61 79 20 66 6f 72 | 20 3a 2d 29 2e 0a 0a 40 |.pay for| :-)...@|
|00000bf0| 6e 6f 64 65 20 4e 61 6d | 69 6e 67 2c 55 73 61 67 |node Nam|ing,Usag|
|00000c00| 65 2c 44 69 73 63 6c 61 | 69 6d 65 72 2c 54 6f 70 |e,Discla|imer,Top|
|00000c10| 0a 40 63 68 61 70 74 65 | 72 20 4e 61 6d 69 6e 67 |.@chapte|r Naming|
|00000c20| 20 63 6f 6e 76 65 6e 74 | 69 6f 6e 73 0a 0a 54 68 | convent|ions..Th|
|00000c30| 69 73 20 6c 69 62 72 61 | 72 79 20 69 73 20 6e 6f |is libra|ry is no|
|00000c40| 74 20 6f 6e 6c 79 20 66 | 6f 72 20 74 68 65 20 65 |t only f|or the e|
|00000c50| 6e 64 20 75 73 65 72 20 | 62 75 74 20 61 6c 73 6f |nd user |but also|
|00000c60| 20 66 6f 72 20 74 68 65 | 20 6c 69 62 72 61 72 79 | for the| library|
|00000c70| 0a 70 72 6f 67 72 61 6d | 6d 65 72 20 28 69 66 20 |.program|mer (if |
|00000c80| 79 6f 75 20 77 61 6e 74 | 20 74 6f 20 77 72 69 74 |you want| to writ|
|00000c90| 65 20 79 6f 75 72 20 6f | 77 6e 20 73 74 61 72 74 |e your o|wn start|
|00000ca0| 75 70 2c 20 65 74 63 29 | 2e 0a 0a 49 66 20 79 6f |up, etc)|...If yo|
|00000cb0| 75 20 77 61 6e 74 20 74 | 6f 20 77 72 69 74 65 20 |u want t|o write |
|00000cc0| 63 6f 64 65 20 66 6f 72 | 20 69 74 20 79 6f 75 20 |code for| it you |
|00000cd0| 73 68 6f 75 6c 64 20 62 | 65 20 61 77 61 72 65 20 |should b|e aware |
|00000ce0| 6f 66 20 74 68 65 20 6e | 6f 72 6d 61 6c 0a 6e 61 |of the n|ormal.na|
|00000cf0| 6d 69 6e 67 20 63 6f 6e | 76 65 6e 74 69 6f 6e 73 |ming con|ventions|
|00000d00| 20 66 6f 72 20 41 4e 53 | 49 20 6c 69 62 72 61 72 | for ANS|I librar|
|00000d10| 69 65 73 3a 0a 0a 40 69 | 74 65 6d 69 7a 65 20 40 |ies:..@i|temize @|
|00000d20| 62 75 6c 6c 65 74 0a 40 | 69 74 65 6d 0a 4e 61 6d |bullet.@|item.Nam|
|00000d30| 65 73 20 77 69 74 68 20 | 6e 6f 20 75 6e 64 65 72 |es with |no under|
|00000d40| 73 63 6f 72 65 20 40 73 | 61 6d 70 7b 66 6f 6f 7d |score @s|amp{foo}|
|00000d50| 20 61 72 65 20 41 4e 53 | 49 20 6f 72 20 50 4f 53 | are ANS|I or POS|
|00000d60| 49 58 20 63 6f 6d 70 6c | 69 61 6e 74 20 2d 20 74 |IX compl|iant - t|
|00000d70| 68 65 72 65 20 69 73 20 | 61 62 73 6f 6c 75 74 65 |here is |absolute|
|00000d80| 6c 79 0a 6e 6f 20 72 69 | 73 6b 20 69 6e 20 75 73 |ly.no ri|sk in us|
|00000d90| 69 6e 67 20 74 68 65 6d | 2e 20 49 66 20 79 6f 75 |ing them|. If you|
|00000da0| 20 75 73 65 20 6f 6e 6c | 79 20 74 68 65 73 65 20 | use onl|y these |
|00000db0| 79 6f 75 20 63 61 6e 20 | 77 72 69 74 65 20 70 6f |you can |write po|
|00000dc0| 72 74 61 62 6c 65 0a 70 | 72 6f 67 72 61 6d 73 2e |rtable.p|rograms.|
|00000dd0| 0a 40 69 74 65 6d 0a 4e | 61 6d 65 73 20 77 69 74 |.@item.N|ames wit|
|00000de0| 68 20 61 20 73 69 6e 67 | 6c 65 20 75 6e 64 65 72 |h a sing|le under|
|00000df0| 73 63 6f 72 65 20 40 73 | 61 6d 70 7b 5f 66 6f 6f |score @s|amp{_foo|
|00000e00| 7d 20 61 72 65 20 41 4e | 53 49 20 65 78 74 65 6e |} are AN|SI exten|
|00000e10| 73 69 6f 6e 73 20 66 6f | 72 20 74 68 65 0a 65 6e |sions fo|r the.en|
|00000e20| 64 20 75 73 65 72 2e 20 | 55 73 75 61 6c 6c 79 20 |d user. |Usually |
|00000e30| 74 68 65 79 20 61 72 65 | 20 76 65 72 79 20 63 6f |they are| very co|
|00000e40| 6d 6d 6f 6e 20 6f 6e 20 | 63 65 72 74 61 69 6e 20 |mmon on |certain |
|00000e50| 73 79 73 74 65 6d 73 20 | 62 75 74 20 6e 6f 74 20 |systems |but not |
|00000e60| 75 73 65 64 20 6f 6e 0a | 6f 74 68 65 72 73 2e 0a |used on.|others..|
|00000e70| 40 69 74 65 6d 0a 4e 61 | 6d 65 73 20 77 69 74 68 |@item.Na|mes with|
|00000e80| 20 74 77 6f 20 75 6e 64 | 65 72 73 63 6f 72 65 73 | two und|erscores|
|00000e90| 20 40 73 61 6d 70 7b 5f | 5f 66 6f 6f 7d 20 61 72 | @samp{_|_foo} ar|
|00000ea0| 65 20 66 6f 72 20 74 68 | 65 20 6c 69 62 72 61 72 |e for th|e librar|
|00000eb0| 79 20 70 72 6f 67 72 61 | 6d 6d 65 72 73 20 6f 6e |y progra|mmers on|
|00000ec0| 6c 79 2e 0a 49 66 20 74 | 68 65 79 20 61 72 65 20 |ly..If t|hey are |
|00000ed0| 6e 6f 74 20 64 6f 63 75 | 6d 65 6e 74 65 64 20 79 |not docu|mented y|
|00000ee0| 6f 75 20 63 61 6e 6e 6f | 74 20 72 65 6c 79 20 6f |ou canno|t rely o|
|00000ef0| 6e 20 74 68 65 6d 2e 20 | 41 6e 64 20 65 76 65 6e |n them. |And even|
|00000f00| 20 69 66 20 74 68 65 79 | 20 61 72 65 0a 79 6f 75 | if they| are.you|
|00000f10| 20 73 68 6f 75 6c 64 20 | 75 73 65 20 74 68 65 6d | should |use them|
|00000f20| 20 6f 6e 6c 79 20 66 6f | 72 20 77 72 69 74 69 6e | only fo|r writin|
|00000f30| 67 20 6c 69 62 72 61 72 | 79 20 63 6f 64 65 2e 0a |g librar|y code..|
|00000f40| 40 65 6e 64 20 69 74 65 | 6d 69 7a 65 0a 0a 54 68 |@end ite|mize..Th|
|00000f50| 65 72 65 20 69 73 20 6f | 6e 6c 79 20 6f 6e 65 20 |ere is o|nly one |
|00000f60| 65 78 63 65 70 74 69 6f | 6e 20 6f 66 20 74 68 65 |exceptio|n of the|
|00000f70| 73 65 20 63 6f 6e 76 65 | 6e 74 69 6f 6e 73 20 28 |se conve|ntions (|
|00000f80| 40 73 61 6d 70 7b 5f 5f | 63 68 6b 61 62 6f 72 74 |@samp{__|chkabort|
|00000f90| 28 29 7d 29 0a 61 6e 64 | 20 74 68 69 73 20 69 73 |()}).and| this is|
|00000fa0| 20 66 6f 72 20 63 6f 6d | 70 61 74 69 62 69 6c 69 | for com|patibili|
|00000fb0| 74 79 20 72 65 61 73 6f | 6e 73 2e 0a 20 0a 40 6e |ty reaso|ns.. .@n|
|00000fc0| 6f 64 65 20 55 73 61 67 | 65 2c 46 65 61 74 75 72 |ode Usag|e,Featur|
|00000fd0| 65 73 2c 4e 61 6d 69 6e | 67 2c 54 6f 70 0a 40 63 |es,Namin|g,Top.@c|
|00000fe0| 68 61 70 74 65 72 20 55 | 73 61 67 65 0a 0a 54 68 |hapter U|sage..Th|
|00000ff0| 65 20 75 73 61 67 65 20 | 6f 66 20 74 68 69 73 20 |e usage |of this |
|00001000| 6c 69 62 72 61 72 79 20 | 69 73 20 6c 69 6b 65 20 |library |is like |
|00001010| 61 6e 79 20 6f 74 68 65 | 72 20 6c 69 6e 6b 20 6c |any othe|r link l|
|00001020| 69 62 72 61 72 79 2e 20 | 54 68 65 20 6f 6e 6c 79 |ibrary. |The only|
|00001030| 0a 69 6d 70 6f 72 74 61 | 6e 74 20 74 68 69 6e 67 |.importa|nt thing|
|00001040| 20 69 73 20 74 68 65 20 | 72 69 67 68 74 20 6c 69 | is the |right li|
|00001050| 6e 6b 61 67 65 20 6f 72 | 64 65 72 3a 0a 0a 40 65 |nkage or|der:..@e|
|00001060| 6e 75 6d 65 72 61 74 65 | 0a 40 69 74 65 6d 0a 54 |numerate|.@item.T|
|00001070| 68 65 20 73 74 61 72 74 | 75 70 20 63 6f 64 65 20 |he start|up code |
|00001080| 68 61 73 20 74 6f 20 62 | 65 20 75 73 65 64 20 66 |has to b|e used f|
|00001090| 69 72 73 74 20 3a 2d 29 | 0a 40 69 74 65 6d 0a 54 |irst :-)|.@item.T|
|000010a0| 68 65 20 73 74 75 62 73 | 2d 6c 69 62 72 61 72 79 |he stubs|-library|
|000010b0| 20 68 61 73 20 74 6f 20 | 62 65 20 75 73 65 64 20 | has to |be used |
|000010c0| 6c 61 73 74 20 73 69 6e | 63 65 20 69 74 20 63 6f |last sin|ce it co|
|000010d0| 6e 74 61 69 6e 73 20 74 | 68 65 20 6c 69 62 72 61 |ntains t|he libra|
|000010e0| 72 79 20 62 61 73 65 20 | 70 6f 69 6e 74 65 72 73 |ry base |pointers|
|000010f0| 2e 0a 40 69 74 65 6d 0a | 54 68 65 20 63 6f 6d 6d |..@item.|The comm|
|00001100| 61 6e 64 6c 69 6e 65 20 | 70 61 72 73 65 72 20 73 |andline |parser s|
|00001110| 68 6f 75 6c 64 20 62 65 | 20 75 73 65 64 20 61 66 |hould be| used af|
|00001120| 74 65 72 20 79 6f 75 72 | 20 63 6f 64 65 20 62 75 |ter your| code bu|
|00001130| 74 20 62 65 66 6f 72 65 | 20 6d 6f 73 74 20 0a 6f |t before| most .o|
|00001140| 74 68 65 72 20 74 68 69 | 6e 67 73 20 6f 72 20 79 |ther thi|ngs or y|
|00001150| 6f 75 20 77 69 6c 6c 20 | 72 75 6e 20 69 6e 74 6f |ou will |run into|
|00001160| 20 70 72 6f 62 6c 65 6d | 73 2e 0a 40 65 6e 64 20 | problem|s..@end |
|00001170| 65 6e 75 6d 65 72 61 74 | 65 0a 0a 4e 6f 72 6d 61 |enumerat|e..Norma|
|00001180| 6c 6c 79 20 74 68 69 73 | 20 69 73 20 68 61 6e 64 |lly this| is hand|
|00001190| 6c 65 64 20 62 79 20 74 | 68 65 20 73 70 65 63 73 |led by t|he specs|
|000011a0| 20 66 69 6c 65 20 6f 66 | 20 67 63 63 2e 0a 0a 40 | file of| gcc...@|
|000011b0| 63 6f 64 65 7b 67 63 63 | 20 28 2d 66 62 61 73 65 |code{gcc| (-fbase|
|000011c0| 72 65 6c 29 20 28 2d 72 | 65 73 69 64 65 6e 74 29 |rel) (-r|esident)|
|000011d0| 20 2d 6e 6f 69 78 65 6d | 75 6c 20 59 4f 55 52 5f | -noixem|ul YOUR_|
|000011e0| 4f 42 4a 45 43 54 53 20 | 28 2d 6e 69 78 5f 6d 61 |OBJECTS |(-nix_ma|
|000011f0| 69 6e 29 20 28 2d 6c 6d | 29 7d 0a 0a 49 66 20 79 |in) (-lm|)}..If y|
|00001200| 6f 75 20 75 73 65 20 40 | 73 61 6d 70 7b 2d 6c 6e |ou use @|samp{-ln|
|00001210| 69 78 5f 6d 61 69 6e 7d | 20 79 6f 75 20 67 65 74 |ix_main}| you get|
|00001220| 20 61 20 64 69 66 66 65 | 72 65 6e 74 20 63 6f 6d | a diffe|rent com|
|00001230| 6d 61 6e 64 6c 69 6e 65 | 20 70 61 72 73 65 72 2e |mandline| parser.|
|00001240| 0a 40 73 61 6d 70 7b 2d | 6c 6d 7d 20 75 73 65 73 |.@samp{-|lm} uses|
|00001250| 20 74 68 65 20 6d 61 74 | 68 20 6c 69 62 72 61 72 | the mat|h librar|
|00001260| 79 2e 0a 0a 42 65 20 61 | 77 61 72 65 20 74 68 61 |y...Be a|ware tha|
|00001270| 74 20 74 68 65 20 66 6f | 72 6d 61 74 74 65 64 20 |t the fo|rmatted |
|00001280| 49 2f 4f 2d 66 75 6e 63 | 74 69 6f 6e 73 20 6e 65 |I/O-func|tions ne|
|00001290| 65 64 20 74 68 65 20 6d | 61 74 68 20 6c 69 62 72 |ed the m|ath libr|
|000012a0| 61 72 79 0a 74 6f 20 77 | 6f 72 6b 20 63 6f 72 72 |ary.to w|ork corr|
|000012b0| 65 63 74 6c 79 20 66 6f | 72 20 66 6c 6f 61 74 69 |ectly fo|r floati|
|000012c0| 6e 67 20 70 6f 69 6e 74 | 20 6e 75 6d 62 65 72 73 |ng point| numbers|
|000012d0| 2e 20 57 69 74 68 6f 75 | 74 20 74 68 65 20 6d 61 |. Withou|t the ma|
|000012e0| 74 68 0a 6c 69 62 72 61 | 72 79 20 79 6f 75 20 67 |th.libra|ry you g|
|000012f0| 65 74 20 6f 6e 6c 79 20 | 66 6c 6f 61 74 69 6e 67 |et only |floating|
|00001300| 20 70 6f 69 6e 74 20 73 | 75 70 70 6f 72 74 20 66 | point s|upport f|
|00001310| 6f 72 20 73 69 6d 70 6c | 65 20 6f 70 65 72 61 74 |or simpl|e operat|
|00001320| 6f 72 73 0a 6c 69 6b 65 | 20 40 73 61 6d 70 7b 2b |ors.like| @samp{+|
|00001330| 7d 2c 20 40 73 61 6d 70 | 7b 2a 7d 2c 20 63 61 73 |}, @samp|{*}, cas|
|00001340| 74 73 20 61 6e 64 20 74 | 68 61 74 20 6c 69 6b 65 |ts and t|hat like|
|00001350| 2e 0a 0a 49 66 20 79 6f | 75 20 64 6f 6e 27 74 20 |...If yo|u don't |
|00001360| 75 73 65 20 74 68 65 20 | 61 73 73 65 6d 62 6c 65 |use the |assemble|
|00001370| 72 20 69 6e 6c 69 6e 65 | 20 66 75 6e 63 74 69 6f |r inline| functio|
|00001380| 6e 73 20 6f 66 20 67 63 | 63 20 79 6f 75 20 77 69 |ns of gc|c you wi|
|00001390| 6c 6c 20 68 61 76 65 0a | 74 6f 20 75 73 65 20 40 |ll have.|to use @|
|000013a0| 73 61 6d 70 7b 6c 69 62 | 61 6d 69 67 61 2e 61 7d |samp{lib|amiga.a}|
|000013b0| 20 69 66 20 79 6f 75 20 | 77 61 6e 74 20 74 6f 20 | if you |want to |
|000013c0| 75 73 65 20 61 6e 79 20 | 41 6d 69 67 61 20 4f 53 |use any |Amiga OS|
|000013d0| 20 66 75 6e 63 74 69 6f | 6e 2e 0a 67 63 63 20 63 | functio|n..gcc c|
|000013e0| 6f 6d 65 73 20 77 69 74 | 68 20 61 20 66 72 65 65 |omes wit|h a free|
|000013f0| 20 76 65 72 73 69 6f 6e | 20 6f 66 20 6c 69 62 61 | version| of liba|
|00001400| 6d 69 67 61 2e 61 20 77 | 68 69 63 68 20 69 73 20 |miga.a w|hich is |
|00001410| 61 20 73 75 62 73 65 74 | 0a 6f 66 20 74 68 65 20 |a subset|.of the |
|00001420| 6f 72 69 67 69 6e 61 6c | 20 6f 6e 65 2e 20 59 6f |original| one. Yo|
|00001430| 75 20 63 61 6e 20 62 75 | 69 6c 64 20 69 74 20 79 |u can bu|ild it y|
|00001440| 6f 75 72 73 65 6c 66 20 | 69 66 20 79 6f 75 20 75 |ourself |if you u|
|00001450| 6e 70 61 63 6b 20 74 68 | 65 20 73 6f 75 72 63 65 |npack th|e source|
|00001460| 73 2c 0a 62 75 74 20 62 | 65 20 70 72 65 70 61 72 |s,.but b|e prepar|
|00001470| 65 64 20 74 68 61 74 20 | 69 74 20 6d 61 79 20 74 |ed that |it may t|
|00001480| 61 6b 65 20 73 6f 6d 65 | 20 74 69 6d 65 2e 0a 0a |ake some| time...|
|00001490| 46 6f 72 20 63 6f 6d 70 | 69 6c 69 6e 67 20 61 34 |For comp|iling a4|
|000014a0| 2d 72 65 6c 61 74 69 76 | 65 20 70 72 6f 67 72 61 |-relativ|e progra|
|000014b0| 6d 73 20 79 6f 75 20 73 | 68 6f 75 6c 64 20 63 68 |ms you s|hould ch|
|000014c0| 6f 6f 73 65 20 74 68 65 | 0a 40 73 61 6d 70 7b 2d |oose the|.@samp{-|
|000014d0| 66 62 61 73 65 72 65 6c | 7d 20 6f 70 74 69 6f 6e |fbaserel|} option|
|000014e0| 2e 20 59 6f 75 20 67 65 | 74 20 72 65 73 69 64 65 |. You ge|t reside|
|000014f0| 6e 74 20 28 70 75 72 65 | 29 20 70 72 6f 67 72 61 |nt (pure|) progra|
|00001500| 6d 73 20 69 66 0a 79 6f | 75 20 73 65 74 20 74 68 |ms if.yo|u set th|
|00001510| 65 20 40 73 61 6d 70 7b | 2d 72 65 73 69 64 65 6e |e @samp{|-residen|
|00001520| 74 7d 20 6f 70 74 69 6f | 6e 2e 20 41 6e 79 74 68 |t} optio|n. Anyth|
|00001530| 69 6e 67 20 65 6c 73 65 | 20 6e 65 63 65 73 73 61 |ing else| necessa|
|00001540| 72 79 20 66 6f 72 20 74 | 68 65 73 65 20 6f 70 74 |ry for t|hese opt|
|00001550| 69 6f 6e 73 0a 69 73 20 | 68 61 6e 64 6c 65 64 20 |ions.is |handled |
|00001560| 62 79 20 74 68 65 20 73 | 70 65 63 73 2d 66 69 6c |by the s|pecs-fil|
|00001570| 65 20 28 63 68 6f 6f 73 | 69 6e 67 20 74 68 65 20 |e (choos|ing the |
|00001580| 72 69 67 68 74 20 73 74 | 61 72 74 75 70 73 20 61 |right st|artups a|
|00001590| 6e 64 20 6c 69 62 72 61 | 72 69 65 73 29 2e 0a 0a |nd libra|ries)...|
|000015a0| 49 66 20 79 6f 75 20 28 | 66 6f 72 20 73 6f 6d 65 |If you (|for some|
|000015b0| 20 72 65 61 73 6f 6e 29 | 20 64 6f 6e 27 74 20 74 | reason)| don't t|
|000015c0| 72 75 73 74 20 79 6f 75 | 20 73 70 65 63 73 2d 66 |rust you| specs-f|
|000015d0| 69 6c 65 20 79 6f 75 20 | 63 61 6e 20 63 61 6c 6c |ile you |can call|
|000015e0| 20 65 76 65 72 79 74 68 | 69 6e 67 0a 62 79 20 68 | everyth|ing.by h|
|000015f0| 61 6e 64 3a 0a 0a 40 63 | 6f 64 65 7b 67 63 63 20 |and:..@c|ode{gcc |
|00001600| 2d 6e 6f 73 74 64 6c 69 | 62 20 6e 63 72 74 30 2e |-nostdli|b ncrt0.|
|00001610| 6f 20 59 4f 55 52 5f 4f | 42 4a 45 43 54 53 20 6c |o YOUR_O|BJECTS l|
|00001620| 69 62 6e 69 78 6d 61 69 | 6e 2e 61 20 28 6c 69 62 |ibnixmai|n.a (lib|
|00001630| 6d 2e 61 29 20 6c 69 62 | 6e 69 78 2e 61 0a 6c 69 |m.a) lib|nix.a.li|
|00001640| 62 73 74 75 62 73 2e 61 | 7d 0a 0a 42 75 74 20 74 |bstubs.a|}..But t|
|00001650| 68 61 74 27 73 20 6e 6f | 74 20 74 68 65 20 72 65 |hat's no|t the re|
|00001660| 63 6f 6d 6d 65 6e 64 65 | 64 20 77 61 79 2e 20 54 |commende|d way. T|
|00001670| 68 65 72 65 66 6f 72 65 | 20 49 20 64 6f 6e 27 74 |herefore| I don't|
|00001680| 20 65 78 70 6c 61 69 6e | 20 74 68 69 73 20 69 6e | explain| this in|
|00001690| 0a 64 65 74 61 69 6c 20 | 68 65 72 65 20 2d 20 75 |.detail |here - u|
|000016a0| 73 65 20 74 68 65 20 40 | 73 61 6d 70 7b 2d 76 7d |se the @|samp{-v}|
|000016b0| 20 6f 70 74 69 6f 6e 20 | 6f 66 20 67 63 63 20 66 | option |of gcc f|
|000016c0| 6f 72 20 6d 6f 72 65 20 | 64 65 74 61 69 6c 73 2e |or more |details.|
|000016d0| 0a 0a 40 6e 6f 64 65 20 | 46 65 61 74 75 72 65 73 |..@node |Features|
|000016e0| 2c 53 70 65 63 69 61 6c | 20 73 74 61 72 74 75 70 |,Special| startup|
|000016f0| 73 2c 55 73 61 67 65 2c | 54 6f 70 0a 40 63 68 61 |s,Usage,|Top.@cha|
|00001700| 70 74 65 72 20 46 65 61 | 74 75 72 65 73 20 2d 20 |pter Fea|tures - |
|00001710| 77 68 61 74 20 79 6f 75 | 20 67 65 74 0a 0a 54 68 |what you| get..Th|
|00001720| 65 20 66 6f 6c 6c 6f 77 | 69 6e 67 20 6c 69 73 74 |e follow|ing list|
|00001730| 20 63 6f 6e 74 61 69 6e | 73 20 74 68 65 20 65 6c | contain|s the el|
|00001740| 65 6d 65 6e 74 73 20 6f | 66 20 74 68 69 73 20 70 |ements o|f this p|
|00001750| 61 63 6b 61 67 65 20 69 | 6e 0a 74 68 65 20 72 69 |ackage i|n.the ri|
|00001760| 67 68 74 20 6c 69 6e 6b | 61 67 65 20 6f 72 64 65 |ght link|age orde|
|00001770| 72 2e 20 54 68 69 73 20 | 6d 65 61 6e 73 20 69 66 |r. This |means if|
|00001780| 20 79 6f 75 20 66 6f 6c | 6c 6f 77 20 74 68 65 20 | you fol|low the |
|00001790| 6c 69 73 74 20 66 72 6f | 6d 0a 74 6f 70 20 74 6f |list fro|m.top to|
|000017a0| 20 62 6f 74 74 6f 6d 20 | 61 6e 64 20 74 61 6b 65 | bottom |and take|
|000017b0| 20 6f 6e 65 20 66 69 6c | 65 20 6f 66 20 65 61 63 | one fil|e of eac|
|000017c0| 68 20 6d 65 6e 75 20 65 | 6e 74 72 79 20 79 6f 75 |h menu e|ntry you|
|000017d0| 20 77 69 6c 6c 20 67 65 | 74 0a 61 20 77 6f 72 6b | will ge|t.a work|
|000017e0| 69 6e 67 20 63 6f 6e 66 | 69 67 75 72 61 74 69 6f |ing conf|iguratio|
|000017f0| 6e 2e 0a 0a 40 6d 65 6e | 75 0a 2a 20 53 74 61 72 |n...@men|u.* Star|
|00001800| 74 75 70 20 63 6f 64 65 | 73 3a 3a 20 20 20 20 20 |tup code|s:: |
|00001810| 20 44 6f 65 73 20 61 6c | 6c 20 77 6f 72 6b 20 6e | Does al|l work n|
|00001820| 65 63 65 73 73 61 72 79 | 20 66 6f 72 20 73 74 61 |ecessary| for sta|
|00001830| 72 74 75 70 2e 0a 20 20 | 59 6f 75 72 20 6f 62 6a |rtup.. |Your obj|
|00001840| 65 63 74 73 20 20 20 20 | 20 20 20 20 20 4e 65 65 |ects | Nee|
|00001850| 64 20 49 20 73 61 79 20 | 61 6e 79 74 68 69 6e 67 |d I say |anything|
|00001860| 20 61 62 6f 75 74 20 74 | 68 61 74 3f 0a 2a 20 43 | about t|hat?.* C|
|00001870| 6f 6d 6d 61 6e 64 6c 69 | 6e 65 20 70 61 72 73 65 |ommandli|ne parse|
|00001880| 72 3a 3a 20 43 61 6c 63 | 75 6c 61 74 65 73 20 61 |r:: Calc|ulates a|
|00001890| 72 67 63 20 61 6e 64 20 | 61 72 67 76 2e 0a 20 20 |rgc and |argv.. |
|000018a0| 6c 69 62 6d 2e 61 20 20 | 20 20 20 20 20 20 20 20 |libm.a | |
|000018b0| 20 20 20 20 20 54 68 65 | 20 6d 61 74 68 20 6c 69 | The| math li|
|000018c0| 62 72 61 72 79 20 28 6f | 70 74 69 6f 6e 61 6c 29 |brary (o|ptional)|
|000018d0| 2e 0a 2a 20 6c 69 62 6e | 69 78 2e 61 3a 3a 20 20 |..* libn|ix.a:: |
|000018e0| 20 20 20 20 20 20 20 20 | 20 54 68 65 20 6c 69 62 | | The lib|
|000018f0| 72 61 72 79 20 69 74 73 | 65 6c 66 2e 0a 2a 20 6c |rary its|elf..* l|
|00001900| 69 62 61 6d 69 67 61 2e | 61 3a 3a 20 20 20 20 20 |ibamiga.|a:: |
|00001910| 20 20 20 20 49 66 20 79 | 6f 75 20 68 61 76 65 20 | If y|ou have |
|00001920| 6f 6e 65 2e 0a 2a 20 64 | 65 74 61 63 68 2e 6f 3a |one..* d|etach.o:|
|00001930| 3a 20 20 20 20 20 20 20 | 20 20 20 20 41 75 74 6f |: | Auto|
|00001940| 20 64 65 74 61 63 68 69 | 6e 67 0a 2a 20 6c 69 62 | detachi|ng.* lib|
|00001950| 73 74 75 62 73 2e 61 3a | 3a 20 20 20 20 20 20 20 |stubs.a:|: |
|00001960| 20 20 54 68 65 20 6c 69 | 62 72 61 72 79 20 62 61 | The li|brary ba|
|00001970| 73 65 73 2e 0a 2a 20 73 | 74 61 63 6b 68 61 6e 64 |ses..* s|tackhand|
|00001980| 6c 69 6e 67 3a 3a 20 20 | 20 20 20 20 28 70 61 72 |ling:: | (par|
|00001990| 74 20 6f 66 20 6c 69 62 | 6e 69 78 2e 61 29 20 73 |t of lib|nix.a) s|
|000019a0| 74 61 63 6b 20 73 77 61 | 70 70 69 6e 67 2c 20 63 |tack swa|pping, c|
|000019b0| 68 65 63 6b 69 6e 67 20 | 61 6e 64 20 65 78 74 65 |hecking |and exte|
|000019c0| 6e 73 69 6f 6e 0a 40 65 | 6e 64 20 6d 65 6e 75 0a |nsion.@e|nd menu.|
|000019d0| 0a 40 6e 6f 64 65 20 53 | 74 61 72 74 75 70 20 63 |.@node S|tartup c|
|000019e0| 6f 64 65 73 2c 43 6f 6d | 6d 61 6e 64 6c 69 6e 65 |odes,Com|mandline|
|000019f0| 20 70 61 72 73 65 72 2c | 46 65 61 74 75 72 65 73 | parser,|Features|
|00001a00| 2c 46 65 61 74 75 72 65 | 73 0a 40 63 68 61 70 74 |,Feature|s.@chapt|
|00001a10| 65 72 20 53 74 61 72 74 | 75 70 20 63 6f 64 65 73 |er Start|up codes|
|00001a20| 0a 0a 54 68 65 72 65 20 | 69 73 20 61 20 6c 6f 74 |..There |is a lot|
|00001a30| 20 6f 66 20 77 6f 72 6b | 20 74 6f 20 64 6f 20 62 | of work| to do b|
|00001a40| 65 66 6f 72 65 20 79 6f | 75 72 20 40 73 61 6d 70 |efore yo|ur @samp|
|00001a50| 7b 6d 61 69 6e 7d 20 66 | 75 6e 63 74 69 6f 6e 0a |{main} f|unction.|
|00001a60| 63 61 6e 20 62 65 20 63 | 61 6c 6c 65 64 20 2d 20 |can be c|alled - |
|00001a70| 6f 70 65 6e 20 73 68 61 | 72 65 64 20 6c 69 62 72 |open sha|red libr|
|00001a80| 61 72 69 65 73 2c 20 6f | 70 65 6e 20 73 74 64 69 |aries, o|pen stdi|
|00001a90| 6e 2c 20 73 74 64 6f 75 | 74 2c 20 65 74 63 2e 0a |n, stdou|t, etc..|
|00001aa0| 44 65 70 65 6e 64 69 6e | 67 20 6f 6e 20 74 68 65 |Dependin|g on the|
|00001ab0| 20 63 6f 6d 70 69 6c 65 | 72 20 6f 70 74 69 6f 6e | compile|r option|
|00001ac0| 73 20 61 6e 64 20 74 68 | 65 20 41 4e 53 49 20 66 |s and th|e ANSI f|
|00001ad0| 75 6e 63 74 69 6f 6e 73 | 20 79 6f 75 20 75 73 65 |unctions| you use|
|00001ae0| 2e 0a 54 68 69 73 20 77 | 6f 72 6b 20 69 73 20 64 |..This w|ork is d|
|00001af0| 6f 6e 65 20 62 79 20 74 | 68 65 20 73 74 61 72 74 |one by t|he start|
|00001b00| 75 70 20 63 6f 64 65 2e | 0a 0a 40 6d 65 6e 75 0a |up code.|..@menu.|
|00001b10| 2a 20 53 74 61 72 74 75 | 70 20 69 6e 74 65 72 66 |* Startu|p interf|
|00001b20| 61 63 65 3a 3a 20 0a 2a | 20 53 74 61 72 74 75 70 |ace:: .*| Startup|
|00001b30| 20 75 73 61 67 65 3a 3a | 0a 40 65 6e 64 20 6d 65 | usage::|.@end me|
|00001b40| 6e 75 0a 0a 54 6f 20 67 | 65 74 20 61 20 73 68 6f |nu..To g|et a sho|
|00001b50| 72 74 20 73 74 61 72 74 | 75 70 20 61 6c 6c 20 74 |rt start|up all t|
|00001b60| 68 65 20 6e 65 63 65 73 | 73 61 72 79 20 6d 6f 64 |he neces|sary mod|
|00001b70| 75 6c 65 73 20 61 72 65 | 20 6f 70 74 69 6f 6e 61 |ules are| optiona|
|00001b80| 6c 20 2d 0a 74 68 65 79 | 20 67 65 74 20 6f 6e 6c |l -.they| get onl|
|00001b90| 79 20 6c 69 6e 6b 65 64 | 20 69 6e 20 69 66 20 79 |y linked| in if y|
|00001ba0| 6f 75 20 75 73 65 20 74 | 68 65 6d 2e 20 54 68 65 |ou use t|hem. The|
|00001bb0| 72 65 20 61 72 65 20 32 | 20 65 78 63 65 70 74 69 |re are 2| excepti|
|00001bc0| 6f 6e 73 0a 66 72 6f 6d | 20 74 68 69 73 20 28 73 |ons.from| this (s|
|00001bd0| 69 6e 63 65 20 74 68 65 | 20 6c 69 6e 6b 65 72 20 |ince the| linker |
|00001be0| 63 61 6e 6e 6f 74 20 63 | 68 65 63 6b 20 66 6f 72 |cannot c|heck for|
|00001bf0| 20 69 74 29 3a 0a 0a 40 | 69 74 65 6d 69 7a 65 20 | it):..@|itemize |
|00001c00| 40 62 75 6c 6c 65 74 0a | 40 69 74 65 6d 0a 54 68 |@bullet.|@item.Th|
|00001c10| 65 20 63 6f 6d 6d 61 6e | 64 6c 69 6e 65 20 70 61 |e comman|dline pa|
|00001c20| 72 73 65 72 2e 20 49 74 | 20 63 61 6e 20 62 65 20 |rser. It| can be |
|00001c30| 64 65 61 63 74 69 76 61 | 74 65 64 20 62 79 20 64 |deactiva|ted by d|
|00001c40| 65 63 6c 61 72 69 6e 67 | 0a 0a 40 63 6f 64 65 7b |eclaring|..@code{|
|00001c50| 5f 5f 6e 6f 63 6f 6d 6d | 61 6e 64 6c 69 6e 65 7d |__nocomm|andline}|
|00001c60| 0a 0a 73 6f 6d 65 77 68 | 65 72 65 20 69 6e 20 79 |..somewh|ere in y|
|00001c70| 6f 75 72 20 70 72 6f 67 | 72 61 6d 20 28 74 68 65 |our prog|ram (the|
|00001c80| 20 74 79 70 65 20 64 6f | 65 73 6e 27 74 20 6d 61 | type do|esn't ma|
|00001c90| 74 74 65 72 29 2e 0a 40 | 69 74 65 6d 0a 54 68 65 |tter)..@|item.The|
|00001ca0| 20 73 68 61 72 65 64 2d | 6c 69 62 72 61 72 79 2d | shared-|library-|
|00001cb0| 6f 70 65 6e 69 6e 67 20 | 6d 6f 64 75 6c 65 2e 20 |opening |module. |
|00001cc0| 59 6f 75 20 73 68 6f 75 | 6c 64 20 6e 6f 74 20 64 |You shou|ld not d|
|00001cd0| 69 73 61 62 6c 65 20 69 | 74 20 75 6e 6c 65 73 73 |isable i|t unless|
|00001ce0| 0a 79 6f 75 20 6b 6e 6f | 77 20 77 68 61 74 20 79 |.you kno|w what y|
|00001cf0| 6f 75 20 61 72 65 20 64 | 6f 69 6e 67 20 73 69 6e |ou are d|oing sin|
|00001d00| 63 65 20 6d 6f 73 74 20 | 6c 69 62 72 61 72 79 20 |ce most |library |
|00001d10| 66 75 6e 63 74 69 6f 6e | 73 20 64 65 70 65 6e 64 |function|s depend|
|00001d20| 20 6f 6e 20 69 74 2e 0a | 40 65 6e 64 20 69 74 65 | on it..|@end ite|
|00001d30| 6d 69 7a 65 0a 0a 54 68 | 65 20 73 74 61 72 74 75 |mize..Th|e startu|
|00001d40| 70 20 63 6f 64 65 73 20 | 69 74 73 65 6c 66 20 61 |p codes |itself a|
|00001d50| 72 65 20 77 72 69 74 74 | 65 6e 20 69 6e 20 61 73 |re writt|en in as|
|00001d60| 73 65 6d 62 6c 79 20 74 | 6f 20 62 65 20 61 73 20 |sembly t|o be as |
|00001d70| 73 68 6f 72 74 20 61 73 | 0a 70 6f 73 73 69 62 6c |short as|.possibl|
|00001d80| 65 2e 0a 0a 48 65 72 65 | 20 69 73 20 61 20 6c 69 |e...Here| is a li|
|00001d90| 74 74 6c 65 20 70 72 6f | 67 72 61 6d 20 74 6f 20 |ttle pro|gram to |
|00001da0| 67 65 74 20 74 68 65 20 | 70 6f 69 6e 74 3a 0a 0a |get the |point:..|
|00001db0| 40 65 78 61 6d 70 6c 65 | 0a 23 69 6e 63 6c 75 64 |@example|.#includ|
|00001dc0| 65 20 3c 69 6e 6c 69 6e | 65 2f 65 78 65 63 2e 68 |e <inlin|e/exec.h|
|00001dd0| 3e 0a 23 69 6e 63 6c 75 | 64 65 20 3c 64 6f 73 2f |>.#inclu|de <dos/|
|00001de0| 64 6f 73 2e 68 3e 0a 23 | 69 6e 63 6c 75 64 65 20 |dos.h>.#|include |
|00001df0| 3c 69 6e 6c 69 6e 65 2f | 64 6f 73 2e 68 3e 0a 23 |<inline/|dos.h>.#|
|00001e00| 69 6e 63 6c 75 64 65 20 | 3c 77 6f 72 6b 62 65 6e |include |<workben|
|00001e10| 63 68 2f 77 6f 72 6b 62 | 65 6e 63 68 2e 68 3e 0a |ch/workb|ench.h>.|
|00001e20| 0a 69 6e 74 20 5f 5f 6e | 6f 63 6f 6d 6d 61 6e 64 |.int __n|ocommand|
|00001e30| 6c 69 6e 65 3d 31 3b 20 | 2f 2a 20 44 69 73 61 62 |line=1; |/* Disab|
|00001e40| 6c 65 20 63 6f 6d 6d 61 | 6e 64 6c 69 6e 65 20 70 |le comma|ndline p|
|00001e50| 61 72 73 69 6e 67 20 20 | 2a 2f 0a 69 6e 74 20 5f |arsing |*/.int _|
|00001e60| 5f 69 6e 69 74 6c 69 62 | 72 61 72 69 65 73 3d 30 |_initlib|raries=0|
|00001e70| 3b 20 2f 2a 20 44 69 73 | 61 62 6c 65 20 61 75 74 |; /* Dis|able aut|
|00001e80| 6f 2d 6c 69 62 72 61 72 | 79 2d 6f 70 65 6e 69 6e |o-librar|y-openin|
|00001e90| 67 20 2a 2f 0a 0a 73 74 | 72 75 63 74 20 44 6f 73 |g */..st|ruct Dos|
|00001ea0| 4c 69 62 72 61 72 79 20 | 2a 44 4f 53 42 61 73 65 |Library |*DOSBase|
|00001eb0| 3d 4e 55 4c 4c 3b 0a 0a | 65 78 74 65 72 6e 20 73 |=NULL;..|extern s|
|00001ec0| 74 72 75 63 74 20 57 42 | 53 74 61 72 74 75 70 20 |truct WB|Startup |
|00001ed0| 2a 5f 57 42 65 6e 63 68 | 4d 73 67 3b 0a 0a 69 6e |*_WBench|Msg;..in|
|00001ee0| 74 20 6d 61 69 6e 28 76 | 6f 69 64 29 0a 40 7b 20 |t main(v|oid).@{ |
|00001ef0| 69 66 28 5f 57 42 65 6e | 63 68 4d 73 67 3d 3d 4e |if(_WBen|chMsg==N|
|00001f00| 55 4c 4c 29 0a 20 20 40 | 7b 20 69 66 28 28 44 4f |ULL). @|{ if((DO|
|00001f10| 53 42 61 73 65 3d 28 73 | 74 72 75 63 74 20 44 6f |SBase=(s|truct Do|
|00001f20| 73 4c 69 62 72 61 72 79 | 20 2a 29 4f 70 65 6e 4c |sLibrary| *)OpenL|
|00001f30| 69 62 72 61 72 79 28 22 | 64 6f 73 2e 6c 69 62 72 |ibrary("|dos.libr|
|00001f40| 61 72 79 22 2c 33 37 29 | 29 21 3d 4e 55 4c 4c 29 |ary",37)|)!=NULL)|
|00001f50| 0a 20 20 20 20 40 7b 20 | 57 72 69 74 65 28 4f 75 |. @{ |Write(Ou|
|00001f60| 74 70 75 74 28 29 2c 22 | 48 65 6c 6c 6f 20 77 6f |tput(),"|Hello wo|
|00001f70| 72 6c 64 5c 6e 22 2c 31 | 32 29 3b 0a 20 20 20 20 |rld\n",1|2);. |
|00001f80| 20 20 43 6c 6f 73 65 4c | 69 62 72 61 72 79 28 28 | CloseL|ibrary((|
|00001f90| 73 74 72 75 63 74 20 4c | 69 62 72 61 72 79 20 2a |struct L|ibrary *|
|00001fa0| 29 44 4f 53 42 61 73 65 | 29 3b 20 40 7d 20 40 7d |)DOSBase|); @} @}|
|00001fb0| 0a 20 20 72 65 74 75 72 | 6e 20 30 3b 0a 40 7d 0a |. retur|n 0;.@}.|
|00001fc0| 40 65 6e 64 20 65 78 61 | 6d 70 6c 65 0a 0a 63 6f |@end exa|mple..co|
|00001fd0| 6d 70 69 6c 65 64 20 61 | 6e 64 20 6c 69 6e 6b 65 |mpiled a|nd linke|
|00001fe0| 64 20 77 69 74 68 0a 0a | 40 63 6f 64 65 7b 67 63 |d with..|@code{gc|
|00001ff0| 63 20 2d 6e 6f 69 78 65 | 6d 75 6c 20 2d 73 20 2d |c -noixe|mul -s -|
|00002000| 4f 32 20 2d 66 62 61 73 | 65 72 65 6c 20 68 65 6c |O2 -fbas|erel hel|
|00002010| 6c 6f 77 6f 72 6c 64 2e | 63 7d 0a 0a 67 69 76 65 |loworld.|c}..give|
|00002020| 73 20 61 6e 20 65 78 65 | 63 75 74 61 62 6c 65 20 |s an exe|cutable |
|00002030| 6f 66 20 34 39 32 20 62 | 79 74 65 73 2e 20 41 6e |of 492 b|ytes. An|
|00002040| 64 20 74 68 69 73 20 77 | 69 74 68 20 74 68 65 20 |d this w|ith the |
|00002050| 6e 6f 72 6d 61 6c 20 40 | 73 61 6d 70 7b 6d 61 69 |normal @|samp{mai|
|00002060| 6e 7d 0a 66 75 6e 63 74 | 69 6f 6e 21 0a 0a 53 6f |n}.funct|ion!..So|
|00002070| 20 79 6f 75 20 6e 65 76 | 65 72 20 6e 65 65 64 20 | you nev|er need |
|00002080| 74 6f 20 74 72 79 20 74 | 6f 20 77 72 69 74 65 20 |to try t|o write |
|00002090| 61 20 70 72 6f 67 72 61 | 6d 20 77 69 74 68 6f 75 |a progra|m withou|
|000020a0| 74 20 61 20 73 74 61 72 | 74 75 70 20 63 6f 64 65 |t a star|tup code|
|000020b0| 2e 0a 0a 40 6e 6f 64 65 | 20 53 74 61 72 74 75 70 |...@node| Startup|
|000020c0| 20 69 6e 74 65 72 66 61 | 63 65 2c 53 74 61 72 74 | interfa|ce,Start|
|000020d0| 75 70 20 75 73 61 67 65 | 2c 53 74 61 72 74 75 70 |up usage|,Startup|
|000020e0| 20 63 6f 64 65 73 2c 53 | 74 61 72 74 75 70 20 63 | codes,S|tartup c|
|000020f0| 6f 64 65 73 0a 40 63 68 | 61 70 74 65 72 20 53 74 |odes.@ch|apter St|
|00002100| 61 72 74 75 70 20 63 6f | 64 65 20 69 6e 74 65 72 |artup co|de inter|
|00002110| 66 61 63 65 0a 0a 54 68 | 65 20 73 74 61 72 74 75 |face..Th|e startu|
|00002120| 70 20 63 6f 64 65 73 20 | 64 6f 20 74 68 65 20 66 |p codes |do the f|
|00002130| 6f 6c 6c 6f 77 69 6e 67 | 3a 0a 0a 40 69 74 65 6d |ollowing|:..@item|
|00002140| 69 7a 65 20 40 62 75 6c | 6c 65 74 0a 40 69 74 65 |ize @bul|let.@ite|
|00002150| 6d 0a 54 68 65 79 20 63 | 61 74 63 68 20 74 68 65 |m.They c|atch the|
|00002160| 20 77 6f 72 6b 62 65 6e | 63 68 20 73 74 61 72 74 | workben|ch start|
|00002170| 75 70 20 6d 65 73 73 61 | 67 65 20 61 6e 64 20 70 |up messa|ge and p|
|00002180| 6c 61 63 65 20 69 74 20 | 69 6e 74 6f 20 74 68 65 |lace it |into the|
|00002190| 0a 76 61 72 69 61 62 6c | 65 20 0a 0a 40 63 6f 64 |.variabl|e ..@cod|
|000021a0| 65 7b 65 78 74 65 72 6e | 20 73 74 72 75 63 74 20 |e{extern| struct |
|000021b0| 57 42 53 74 61 72 74 75 | 70 20 2a 5f 57 42 65 6e |WBStartu|p *_WBen|
|000021c0| 63 68 4d 73 67 7d 0a 0a | 79 6f 75 20 63 61 6e 20 |chMsg}..|you can |
|000021d0| 73 69 6d 70 6c 79 20 6c | 6f 6f 6b 20 69 6e 74 6f |simply l|ook into|
|000021e0| 20 74 68 69 73 20 70 6c | 61 63 65 20 28 61 6e 64 | this pl|ace (and|
|000021f0| 20 74 65 73 74 20 66 6f | 72 20 61 20 40 73 61 6d | test fo|r a @sam|
|00002200| 70 7b 4e 55 4c 4c 7d 20 | 70 6f 69 6e 74 65 72 29 |p{NULL} |pointer)|
|00002210| 20 74 6f 20 0a 63 68 65 | 63 6b 20 69 66 20 79 6f | to .che|ck if yo|
|00002220| 75 72 20 70 72 6f 67 72 | 61 6d 20 77 61 73 20 73 |ur progr|am was s|
|00002230| 74 61 72 74 65 64 20 66 | 72 6f 6d 20 57 42 2e 20 |tarted f|rom WB. |
|00002240| 49 66 20 74 68 69 73 20 | 69 73 20 61 20 40 73 61 |If this |is a @sa|
|00002250| 6d 70 7b 4e 55 4c 4c 7d | 20 70 6f 69 6e 74 65 72 |mp{NULL}| pointer|
|00002260| 0a 0a 40 63 6f 64 65 7b | 65 78 74 65 72 6e 20 63 |..@code{|extern c|
|00002270| 68 61 72 20 2a 5f 5f 63 | 6f 6d 6d 61 6e 64 6c 69 |har *__c|ommandli|
|00002280| 6e 65 7d 0a 0a 63 6f 6e | 74 61 69 6e 73 20 74 68 |ne}..con|tains th|
|00002290| 65 20 28 40 73 61 6d 70 | 7b 5c 6e 7d 20 74 65 72 |e (@samp|{\n} ter|
|000022a0| 6d 69 6e 61 74 65 64 29 | 20 70 61 72 61 6d 65 74 |minated)| paramet|
|000022b0| 65 72 73 20 6f 66 20 74 | 68 65 20 63 6f 6d 6d 61 |ers of t|he comma|
|000022c0| 6e 64 6c 69 6e 65 2e 0a | 40 69 74 65 6d 0a 54 68 |ndline..|@item.Th|
|000022d0| 65 79 20 63 61 6c 6c 20 | 61 6c 6c 20 66 75 6e 63 |ey call |all func|
|000022e0| 74 69 6f 6e 73 20 69 6e | 20 74 68 65 20 0a 0a 40 |tions in| the ..@|
|000022f0| 63 6f 64 65 7b 6c 6f 6e | 67 20 5f 5f 49 4e 49 54 |code{lon|g __INIT|
|00002300| 5f 4c 49 53 54 5f 5f 5b | 5d 3b 7d 0a 0a 77 69 74 |_LIST__[|];}..wit|
|00002310| 68 20 61 73 63 65 6e 64 | 69 6e 67 20 70 72 69 6f |h ascend|ing prio|
|00002320| 72 69 74 79 2e 0a 40 69 | 74 65 6d 0a 54 68 65 79 |rity..@i|tem.They|
|00002330| 20 63 61 6c 6c 20 74 68 | 65 20 66 75 6e 63 74 69 | call th|e functi|
|00002340| 6f 6e 0a 0a 40 63 6f 64 | 65 7b 69 6e 74 20 6d 61 |on..@cod|e{int ma|
|00002350| 69 6e 28 69 6e 74 20 61 | 72 67 63 2c 63 68 61 72 |in(int a|rgc,char|
|00002360| 20 2a 61 72 67 76 5b 5d | 29 7d 0a 0a 59 6f 75 20 | *argv[]|)}..You |
|00002370| 63 61 6e 20 65 78 69 74 | 20 62 79 20 73 69 6d 70 |can exit| by simp|
|00002380| 6c 79 20 66 61 6c 6c 69 | 6e 67 20 74 68 72 6f 75 |ly falli|ng throu|
|00002390| 67 68 20 74 68 65 20 65 | 6e 64 20 6f 66 20 40 73 |gh the e|nd of @s|
|000023a0| 61 6d 70 7b 6d 61 69 6e | 7d 20 6f 72 20 62 79 20 |amp{main|} or by |
|000023b0| 63 61 6c 6c 69 6e 67 0a | 0a 40 63 6f 64 65 7b 5f |calling.|.@code{_|
|000023c0| 5f 76 6f 6c 61 74 69 6c | 65 20 76 6f 69 64 20 65 |_volatil|e void e|
|000023d0| 78 69 74 28 69 6e 74 20 | 72 65 74 75 72 6e 63 6f |xit(int |returnco|
|000023e0| 64 65 29 7d 0a 0a 77 68 | 69 63 68 20 64 6f 65 73 |de)}..wh|ich does|
|000023f0| 20 74 68 65 20 63 6c 65 | 61 6e 75 70 3a 0a 40 69 | the cle|anup:.@i|
|00002400| 74 65 6d 0a 49 74 20 63 | 61 6c 6c 73 20 61 6c 6c |tem.It c|alls all|
|00002410| 20 66 75 6e 63 74 69 6f | 6e 73 20 69 6e 20 74 68 | functio|ns in th|
|00002420| 65 0a 0a 40 63 6f 64 65 | 7b 6c 6f 6e 67 20 5f 5f |e..@code|{long __|
|00002430| 45 58 49 54 5f 4c 49 53 | 54 5f 5f 5b 5d 3b 7d 0a |EXIT_LIS|T__[];}.|
|00002440| 0a 77 69 74 68 20 64 65 | 73 63 65 6e 64 69 6e 67 |.with de|scending|
|00002450| 20 70 72 69 6f 72 69 74 | 79 2e 0a 40 69 74 65 6d | priorit|y..@item|
|00002460| 0a 49 74 20 72 65 70 6c | 79 73 20 74 68 65 20 57 |.It repl|ys the W|
|00002470| 42 20 73 74 61 72 74 75 | 70 20 6d 65 73 73 61 67 |B startu|p messag|
|00002480| 65 20 69 66 20 6e 65 63 | 65 73 73 61 72 79 2c 20 |e if nec|essary, |
|00002490| 72 65 73 65 74 73 20 74 | 68 65 20 73 74 61 63 6b |resets t|he stack|
|000024a0| 70 6f 69 6e 74 65 72 0a | 61 6e 64 20 72 65 74 75 |pointer.|and retu|
|000024b0| 72 6e 73 20 74 6f 20 74 | 68 65 20 73 68 65 6c 6c |rns to t|he shell|
|000024c0| 2e 0a 40 65 6e 64 20 69 | 74 65 6d 69 7a 65 0a 0a |..@end i|temize..|
|000024d0| 40 73 61 6d 70 7b 5f 5f | 49 4e 49 54 5f 4c 49 53 |@samp{__|INIT_LIS|
|000024e0| 54 5f 5f 7d 20 61 6e 64 | 20 40 73 61 6d 70 7b 5f |T__} and| @samp{_|
|000024f0| 5f 45 58 49 54 5f 4c 49 | 53 54 5f 5f 7d 20 61 72 |_EXIT_LI|ST__} ar|
|00002500| 65 20 74 77 6f 20 73 65 | 74 20 65 6c 65 6d 65 6e |e two se|t elemen|
|00002510| 74 73 0a 77 68 69 63 68 | 20 61 72 65 20 61 20 73 |ts.which| are a s|
|00002520| 70 65 63 69 61 6c 69 74 | 79 20 6f 66 20 74 68 65 |pecialit|y of the|
|00002530| 20 67 6e 75 20 6c 64 2e | 20 53 69 6e 63 65 20 65 | gnu ld.| Since e|
|00002540| 76 65 72 79 74 68 69 6e | 67 20 74 68 61 74 20 6e |verythin|g that n|
|00002550| 65 65 64 73 0a 69 6e 69 | 74 69 61 6c 69 7a 61 74 |eeds.ini|tializat|
|00002560| 69 6f 6e 20 77 6f 72 6b | 73 20 6f 76 65 72 20 74 |ion work|s over t|
|00002570| 68 65 73 65 20 74 77 6f | 20 6c 69 73 74 73 20 74 |hese two| lists t|
|00002580| 68 65 20 62 61 72 65 20 | 73 74 61 72 74 75 70 73 |he bare |startups|
|00002590| 20 61 72 65 0a 76 65 72 | 79 20 73 68 6f 72 74 2e | are.ver|y short.|
|000025a0| 20 49 6e 20 66 61 63 74 | 20 74 68 65 79 20 61 72 | In fact| they ar|
|000025b0| 65 20 65 76 65 6e 20 73 | 68 6f 72 74 65 72 20 74 |e even s|horter t|
|000025c0| 68 65 6e 20 73 6f 6d 65 | 20 6c 6f 77 2d 6c 65 76 |hen some| low-lev|
|000025d0| 65 6c 2d 73 74 61 72 74 | 75 70 73 0a 0a 59 6f 75 |el-start|ups..You|
|000025e0| 20 63 61 6e 20 65 61 73 | 69 6c 79 20 61 64 64 20 | can eas|ily add |
|000025f0| 79 6f 75 72 0a 6f 77 6e | 20 66 75 6e 63 74 69 6f |your.own| functio|
|00002600| 6e 73 20 74 6f 20 74 68 | 65 20 73 74 61 72 74 75 |ns to th|e startu|
|00002610| 70 20 70 72 6f 63 65 64 | 75 72 65 20 62 79 20 75 |p proced|ure by u|
|00002620| 73 69 6e 67 20 74 68 65 | 20 6d 61 63 72 6f 73 0a |sing the| macros.|
|00002630| 69 6e 20 74 68 65 20 66 | 69 6c 65 20 40 73 61 6d |in the f|ile @sam|
|00002640| 70 7b 68 65 61 64 65 72 | 73 2f 73 74 61 62 73 2e |p{header|s/stabs.|
|00002650| 68 7d 20 2d 20 62 75 74 | 20 6b 65 65 70 20 69 6e |h} - but| keep in|
|00002660| 20 6d 69 6e 64 20 74 68 | 61 74 20 74 68 69 73 0a | mind th|at this.|
|00002670| 69 73 20 6e 6f 6e 2d 70 | 6f 72 74 61 62 6c 65 2e |is non-p|ortable.|
|00002680| 20 50 72 69 6f 72 69 74 | 79 20 76 61 6c 75 65 73 | Priorit|y values|
|00002690| 20 3c 3d 30 20 61 72 65 | 20 72 65 73 65 72 76 65 | <=0 are| reserve|
|000026a0| 64 20 66 6f 72 20 6c 69 | 62 72 61 72 79 20 69 6d |d for li|brary im|
|000026b0| 70 6c 65 6d 65 6e 74 6f | 72 73 2e 0a 0a 40 6e 6f |plemento|rs...@no|
|000026c0| 64 65 20 53 74 61 72 74 | 75 70 20 75 73 61 67 65 |de Start|up usage|
|000026d0| 2c 2c 53 74 61 72 74 75 | 70 20 69 6e 74 65 72 66 |,,Startu|p interf|
|000026e0| 61 63 65 2c 53 74 61 72 | 74 75 70 20 63 6f 64 65 |ace,Star|tup code|
|000026f0| 73 0a 40 63 68 61 70 74 | 65 72 20 53 74 61 72 74 |s.@chapt|er Start|
|00002700| 75 70 20 63 6f 64 65 20 | 75 73 61 67 65 0a 0a 54 |up code |usage..T|
|00002710| 68 65 72 65 20 61 72 65 | 20 63 75 72 72 65 6e 74 |here are| current|
|00002720| 6c 79 20 33 20 73 74 61 | 72 74 75 70 20 63 6f 64 |ly 3 sta|rtup cod|
|00002730| 65 73 20 69 6e 20 74 68 | 69 73 20 70 61 63 6b 61 |es in th|is packa|
|00002740| 67 65 20 28 6d 61 79 62 | 65 20 74 68 65 72 65 20 |ge (mayb|e there |
|00002750| 77 69 6c 6c 20 62 65 20 | 6d 6f 72 65 0a 69 6e 20 |will be |more.in |
|00002760| 74 68 65 20 66 75 74 75 | 72 65 29 2e 20 44 65 70 |the futu|re). Dep|
|00002770| 65 6e 64 69 6e 67 20 6f | 6e 20 74 68 65 20 63 6f |ending o|n the co|
|00002780| 64 65 20 61 6e 64 20 64 | 61 74 61 20 6d 6f 64 65 |de and d|ata mode|
|00002790| 6c 20 79 6f 75 20 75 73 | 65 20 61 6e 64 20 73 6f |l you us|e and so|
|000027a0| 6d 65 20 6f 74 68 65 72 | 0a 74 68 69 6e 67 73 20 |me other|.things |
|000027b0| 79 6f 75 20 73 68 6f 75 | 6c 64 20 63 68 6f 6f 73 |you shou|ld choos|
|000027c0| 65 20 6f 6e 65 20 6f 66 | 20 74 68 65 6d 3a 0a 0a |e one of| them:..|
|000027d0| 40 74 61 62 6c 65 20 40 | 73 61 6d 70 0a 40 69 74 |@table @|samp.@it|
|000027e0| 65 6d 20 6e 63 72 74 30 | 2e 6f 0a 54 68 69 73 20 |em ncrt0|.o.This |
|000027f0| 69 73 20 74 68 65 20 6e | 6f 72 6d 61 6c 20 28 69 |is the n|ormal (i|
|00002800| 2e 65 2e 20 6c 61 72 67 | 65 20 63 6f 64 65 2c 20 |.e. larg|e code, |
|00002810| 6c 61 72 67 65 20 64 61 | 74 61 20 6d 6f 64 65 6c |large da|ta model|
|00002820| 29 20 73 74 61 72 74 75 | 70 2e 0a 49 74 20 63 6f |) startu|p..It co|
|00002830| 6e 74 61 69 6e 73 20 61 | 20 40 73 61 6d 70 7b 67 |ntains a| @samp{g|
|00002840| 65 74 61 34 28 29 7d 20 | 65 6e 74 72 79 20 70 6f |eta4()} |entry po|
|00002850| 69 6e 74 20 74 6f 20 65 | 6e 61 62 6c 65 20 79 6f |int to e|nable yo|
|00002860| 75 20 74 6f 20 75 73 65 | 20 6f 6e 65 20 73 6f 75 |u to use| one sou|
|00002870| 72 63 65 0a 66 6f 72 20 | 74 77 6f 20 63 6f 64 65 |rce.for |two code|
|00002880| 20 6d 6f 64 65 6c 73 2e | 20 54 68 65 72 65 20 69 | models.| There i|
|00002890| 73 20 6e 6f 20 6f 74 68 | 65 72 20 6e 65 65 64 20 |s no oth|er need |
|000028a0| 66 6f 72 20 74 68 69 73 | 20 66 75 6e 63 74 69 6f |for this| functio|
|000028b0| 6e 2e 0a 40 69 74 65 6d | 20 6e 62 63 72 74 30 2e |n..@item| nbcrt0.|
|000028c0| 6f 0a 54 68 69 73 20 6f | 6e 65 20 69 73 20 66 6f |o.This o|ne is fo|
|000028d0| 72 20 63 6f 6d 70 69 6c | 69 6e 67 20 73 6d 61 6c |r compil|ing smal|
|000028e0| 6c 20 64 61 74 61 20 6d | 6f 64 65 6c 20 28 61 34 |l data m|odel (a4|
|000028f0| 20 72 65 6c 61 74 69 76 | 65 29 20 70 72 6f 67 72 | relativ|e) progr|
|00002900| 61 6d 73 2e 0a 54 68 65 | 72 65 20 69 73 20 61 20 |ams..The|re is a |
|00002910| 40 73 61 6d 70 7b 67 65 | 74 61 34 28 29 7d 20 65 |@samp{ge|ta4()} e|
|00002920| 6e 74 72 79 20 74 68 61 | 74 20 70 6c 61 63 65 73 |ntry tha|t places|
|00002930| 20 74 68 65 20 72 69 67 | 68 74 20 69 6e 66 6f 72 | the rig|ht infor|
|00002940| 6d 61 74 69 6f 6e 20 69 | 6e 74 6f 20 61 34 2e 0a |mation i|nto a4..|
|00002950| 55 73 65 20 74 68 69 73 | 20 73 74 61 72 74 75 70 |Use this| startup|
|00002960| 20 63 6f 64 65 20 69 66 | 20 79 6f 75 20 63 6f 6d | code if| you com|
|00002970| 70 69 6c 65 64 20 77 69 | 74 68 20 40 73 61 6d 70 |piled wi|th @samp|
|00002980| 7b 2d 66 62 61 73 65 72 | 65 6c 7d 2e 0a 40 69 74 |{-fbaser|el}..@it|
|00002990| 65 6d 20 6e 72 63 72 74 | 30 2e 6f 0a 54 68 69 73 |em nrcrt|0.o.This|
|000029a0| 20 73 74 61 72 74 75 70 | 20 63 6f 64 65 20 61 6c | startup| code al|
|000029b0| 6c 6f 63 61 74 65 73 20 | 61 20 6e 65 77 20 64 61 |locates |a new da|
|000029c0| 74 61 20 61 72 65 61 20 | 65 76 65 72 79 20 74 69 |ta area |every ti|
|000029d0| 6d 65 20 79 6f 75 20 63 | 61 6c 6c 20 69 74 2e 0a |me you c|all it..|
|000029e0| 45 76 65 6e 20 69 66 20 | 79 6f 75 20 64 6f 6e 27 |Even if |you don'|
|000029f0| 74 20 63 61 6c 6c 20 69 | 74 20 61 74 20 61 6c 6c |t call i|t at all|
|00002a00| 20 74 68 65 20 64 61 74 | 61 20 61 72 65 20 69 73 | the dat|a are is|
|00002a10| 20 74 68 65 72 65 20 6f | 6e 63 65 2e 0a 54 68 69 | there o|nce..Thi|
|00002a20| 73 20 67 69 76 65 73 20 | 79 6f 75 20 6d 75 6c 74 |s gives |you mult|
|00002a30| 69 65 6e 74 72 61 6e 74 | 20 61 6e 64 20 72 65 65 |ientrant| and ree|
|00002a40| 6e 74 72 61 6e 74 20 63 | 6f 64 65 2e 0a 54 68 65 |ntrant c|ode..The|
|00002a50| 72 65 66 6f 72 65 20 74 | 68 69 73 20 73 74 61 72 |refore t|his star|
|00002a60| 74 75 70 20 63 6f 64 65 | 20 69 73 20 66 6f 72 20 |tup code| is for |
|00002a70| 63 6f 6d 70 69 6c 69 6e | 67 20 72 65 73 69 64 65 |compilin|g reside|
|00002a80| 6e 74 20 28 70 75 72 65 | 29 20 70 72 6f 67 72 61 |nt (pure|) progra|
|00002a90| 6d 73 2e 0a 52 65 73 69 | 64 65 6e 74 20 70 72 6f |ms..Resi|dent pro|
|00002aa0| 67 72 61 6d 73 20 61 72 | 65 20 61 6c 77 61 79 73 |grams ar|e always|
|00002ab0| 20 73 6d 61 6c 6c 20 64 | 61 74 61 20 6d 6f 64 65 | small d|ata mode|
|00002ac0| 6c 20 69 66 20 79 6f 75 | 20 6c 65 74 20 74 68 65 |l if you| let the|
|00002ad0| 20 63 6f 6d 70 69 6c 65 | 72 20 0a 64 6f 20 74 68 | compile|r .do th|
|00002ae0| 65 20 77 6f 72 6b 2e 0a | 0a 54 68 65 72 65 20 69 |e work..|.There i|
|00002af0| 73 20 6e 6f 20 40 73 61 | 6d 70 7b 67 65 74 61 34 |s no @sa|mp{geta4|
|00002b00| 28 29 7d 20 65 6e 74 72 | 79 20 2d 20 49 20 6a 75 |()} entr|y - I ju|
|00002b10| 73 74 20 64 6f 6e 27 74 | 20 6b 6e 6f 77 20 68 6f |st don't| know ho|
|00002b20| 77 20 74 68 69 73 20 63 | 6f 75 6c 64 20 62 65 20 |w this c|ould be |
|00002b30| 64 6f 6e 65 2e 0a 28 49 | 66 20 79 6f 75 20 73 74 |done..(I|f you st|
|00002b40| 61 72 74 20 79 6f 75 72 | 20 63 6f 64 65 20 31 30 |art your| code 10|
|00002b50| 20 74 69 6d 65 73 20 61 | 6e 64 20 77 61 6e 74 20 | times a|nd want |
|00002b60| 74 6f 20 61 63 63 65 73 | 73 20 67 6c 6f 62 61 6c |to acces|s global|
|00002b70| 20 64 61 74 61 20 0a 6f | 75 74 20 6f 66 20 61 20 | data .o|ut of a |
|00002b80| 68 6f 6f 6b 20 79 6f 75 | 20 63 61 6e 6e 6f 74 20 |hook you| cannot |
|00002b90| 74 65 6c 6c 20 77 68 69 | 63 68 20 6f 6e 65 20 6f |tell whi|ch one o|
|00002ba0| 66 20 74 68 65 20 31 30 | 20 64 61 74 61 20 61 72 |f the 10| data ar|
|00002bb0| 65 61 73 20 74 6f 20 75 | 73 65 20 0a 62 65 63 61 |eas to u|se .beca|
|00002bc0| 75 73 65 20 79 6f 75 20 | 77 61 6e 74 20 74 6f 20 |use you |want to |
|00002bd0| 61 63 63 65 73 73 20 74 | 68 65 20 64 61 74 61 20 |access t|he data |
|00002be0| 66 72 6f 6d 20 61 20 64 | 69 66 66 65 72 65 6e 74 |from a d|ifferent|
|00002bf0| 20 74 61 73 6b 21 29 0a | 40 65 6e 64 20 74 61 62 | task!).|@end tab|
|00002c00| 6c 65 0a 0a 40 6e 6f 64 | 65 20 43 6f 6d 6d 61 6e |le..@nod|e Comman|
|00002c10| 64 6c 69 6e 65 20 70 61 | 72 73 65 72 2c 6c 69 62 |dline pa|rser,lib|
|00002c20| 6e 69 78 2e 61 2c 53 74 | 61 72 74 75 70 20 63 6f |nix.a,St|artup co|
|00002c30| 64 65 73 2c 46 65 61 74 | 75 72 65 73 0a 40 63 68 |des,Feat|ures.@ch|
|00002c40| 61 70 74 65 72 20 43 6f | 6d 6d 61 6e 64 6c 69 6e |apter Co|mmandlin|
|00002c50| 65 20 70 61 72 73 65 72 | 0a 0a 54 68 65 72 65 20 |e parser|..There |
|00002c60| 61 72 65 20 63 75 72 72 | 65 6e 74 6c 79 20 32 20 |are curr|ently 2 |
|00002c70| 63 6f 6d 6d 61 6e 64 6c | 69 6e 65 20 70 61 72 73 |commandl|ine pars|
|00002c80| 65 72 20 6d 6f 64 75 6c | 65 73 20 69 6e 20 74 68 |er modul|es in th|
|00002c90| 65 20 6c 69 62 6e 69 78 | 20 70 61 63 6b 61 67 65 |e libnix| package|
|00002ca0| 2e 0a 59 6f 75 20 63 61 | 6e 20 65 61 73 69 6c 79 |..You ca|n easily|
|00002cb0| 20 77 72 69 74 65 20 79 | 6f 75 72 20 6f 77 6e 20 | write y|our own |
|00002cc0| 62 79 20 6c 6f 6f 6b 69 | 6e 67 20 69 6e 74 6f 20 |by looki|ng into |
|00002cd0| 74 68 65 20 65 78 61 6d | 70 6c 65 73 0a 0a 40 74 |the exam|ples..@t|
|00002ce0| 61 62 6c 65 20 40 63 6f | 64 65 0a 40 69 74 65 6d |able @co|de.@item|
|00002cf0| 20 6c 69 62 6e 69 78 6d | 61 69 6e 2e 61 0a 54 68 | libnixm|ain.a.Th|
|00002d00| 69 73 20 69 73 20 74 68 | 65 20 6e 6f 72 6d 61 6c |is is th|e normal|
|00002d10| 20 6f 6e 65 2c 20 69 2e | 65 2e 20 69 74 20 64 6f | one, i.|e. it do|
|00002d20| 65 73 20 61 6c 6c 20 74 | 68 65 20 77 6f 72 6b 20 |es all t|he work |
|00002d30| 6e 65 63 65 73 73 61 72 | 79 20 66 6f 72 0a 41 4e |necessar|y for.AN|
|00002d40| 53 49 20 63 6f 6d 70 61 | 74 69 62 69 6c 69 74 79 |SI compa|tibility|
|00002d50| 20 61 6e 64 20 67 69 76 | 65 73 20 79 6f 75 20 74 | and giv|es you t|
|00002d60| 68 65 20 6e 6f 72 6d 61 | 6c 20 40 73 61 6d 70 7b |he norma|l @samp{|
|00002d70| 6d 61 69 6e 7d 20 63 61 | 6c 6c 69 6e 67 0a 63 6f |main} ca|lling.co|
|00002d80| 6e 76 65 6e 74 69 6f 6e | 2e 20 59 6f 75 20 63 61 |nvention|. You ca|
|00002d90| 6e 20 73 68 75 74 20 64 | 6f 77 6e 20 74 68 65 20 |n shut d|own the |
|00002da0| 63 6f 6d 6d 61 6e 64 6c | 69 6e 65 20 70 61 72 73 |commandl|ine pars|
|00002db0| 69 6e 67 20 28 69 66 20 | 79 6f 75 20 77 61 6e 74 |ing (if |you want|
|00002dc0| 0a 74 6f 20 75 73 65 20 | 74 68 65 20 61 6d 69 67 |.to use |the amig|
|00002dd0| 61 20 4f 53 20 63 6f 6d | 6d 61 6e 64 6c 69 6e 65 |a OS com|mandline|
|00002de0| 20 70 61 72 73 65 72 29 | 20 62 79 20 64 65 63 6c | parser)| by decl|
|00002df0| 61 72 69 6e 67 0a 0a 40 | 63 6f 64 65 7b 5f 5f 6e |aring..@|code{__n|
|00002e00| 6f 63 6f 6d 6d 61 6e 64 | 6c 69 6e 65 7d 0a 0a 73 |ocommand|line}..s|
|00002e10| 6f 6d 65 77 68 65 72 65 | 20 69 6e 20 79 6f 75 72 |omewhere| in your|
|00002e20| 20 63 6f 64 65 20 28 74 | 68 65 20 74 79 70 65 20 | code (t|he type |
|00002e30| 6f 66 20 69 74 20 61 63 | 74 75 61 6c 6c 79 20 64 |of it ac|tually d|
|00002e40| 6f 65 73 6e 27 74 20 6d | 61 74 74 65 72 29 2e 20 |oesn't m|atter). |
|00002e50| 54 68 69 73 0a 73 70 61 | 72 65 73 20 73 6f 6d 65 |This.spa|res some|
|00002e60| 20 62 79 74 65 73 20 61 | 6e 64 20 69 73 20 63 6f | bytes a|nd is co|
|00002e70| 6d 70 61 74 69 62 6c 65 | 20 74 6f 20 65 76 65 72 |mpatible| to ever|
|00002e80| 79 20 6f 74 68 65 72 20 | 63 6f 6d 70 69 6c 65 72 |y other |compiler|
|00002e90| 2e 0a 0a 41 6e 64 20 79 | 6f 75 20 63 61 6e 20 64 |...And y|ou can d|
|00002ea0| 65 63 6c 61 72 65 20 79 | 6f 75 72 20 6f 77 6e 20 |eclare y|our own |
|00002eb0| 57 42 20 73 68 65 6c 6c | 20 77 69 6e 64 6f 77 20 |WB shell| window |
|00002ec0| 62 79 20 64 65 63 6c 61 | 72 69 6e 67 20 61 0a 0a |by decla|ring a..|
|00002ed0| 40 63 6f 64 65 7b 63 68 | 61 72 20 5f 5f 73 74 64 |@code{ch|ar __std|
|00002ee0| 69 6f 77 69 6e 5b 5d 7d | 0a 0a 76 61 72 69 61 62 |iowin[]}|..variab|
|00002ef0| 6c 65 20 73 6f 6d 65 77 | 68 65 72 65 20 69 6e 20 |le somew|here in |
|00002f00| 79 6f 75 72 20 63 6f 64 | 65 20 28 62 75 74 20 6f |your cod|e (but o|
|00002f10| 6e 6c 79 20 69 66 20 79 | 6f 75 20 70 61 72 73 65 |nly if y|ou parse|
|00002f20| 20 74 68 65 20 63 6f 6d | 6d 61 6e 64 6c 69 6e 65 | the com|mandline|
|00002f30| 20 2d 0a 77 69 74 68 6f | 75 74 20 74 68 65 20 63 | -.witho|ut the c|
|00002f40| 6f 6d 6d 61 6e 64 6c 69 | 6e 65 20 70 61 72 73 65 |ommandli|ne parse|
|00002f50| 72 20 79 6f 75 20 67 65 | 74 20 6e 6f 20 77 69 6e |r you ge|t no win|
|00002f60| 64 6f 77 20 61 74 20 61 | 6c 6c 21 29 2e 0a 0a 40 |dow at a|ll!)...@|
|00002f70| 69 74 65 6d 20 6c 69 62 | 6e 69 78 5f 6d 61 69 6e |item lib|nix_main|
|00002f80| 2e 61 0a 54 68 69 73 20 | 69 73 20 61 20 73 70 65 |.a.This |is a spe|
|00002f90| 63 69 61 6c 20 76 65 72 | 73 69 6f 6e 20 6f 66 20 |cial ver|sion of |
|00002fa0| 61 20 63 6f 6d 6d 61 6e | 64 6c 69 6e 65 20 70 61 |a comman|dline pa|
|00002fb0| 72 73 65 72 20 2d 20 69 | 74 20 64 6f 65 73 6e 27 |rser - i|t doesn'|
|00002fc0| 74 20 63 61 6c 6c 0a 74 | 68 65 20 6e 6f 72 6d 61 |t call.t|he norma|
|00002fd0| 6c 20 40 73 61 6d 70 7b | 6d 61 69 6e 7d 20 62 75 |l @samp{|main} bu|
|00002fe0| 74 0a 0a 40 63 6f 64 65 | 7b 69 6e 74 20 6d 61 69 |t..@code|{int mai|
|00002ff0| 6e 28 63 68 61 72 20 2a | 63 6f 6d 6d 61 6e 64 6c |n(char *|commandl|
|00003000| 69 6e 65 29 7d 0a 0a 40 | 73 61 6d 70 7b 63 6f 6d |ine)}..@|samp{com|
|00003010| 6d 61 6e 64 6c 69 6e 65 | 7d 20 69 73 20 74 68 65 |mandline|} is the|
|00003020| 20 63 6f 6d 70 6c 65 74 | 65 20 63 6f 6d 6d 61 6e | complet|e comman|
|00003030| 64 6c 69 6e 65 20 2d 20 | 69 6e 63 6c 75 64 69 6e |dline - |includin|
|00003040| 67 20 74 68 65 20 71 75 | 6f 74 65 64 0a 66 69 6c |g the qu|oted.fil|
|00003050| 65 6e 61 6d 65 20 6f 66 | 20 79 6f 75 72 20 70 72 |ename of| your pr|
|00003060| 6f 67 72 61 6d 20 28 69 | 74 27 73 20 6f 6e 6c 79 |ogram (i|t's only|
|00003070| 20 71 75 6f 74 65 64 2c | 20 6e 6f 74 20 65 73 63 | quoted,| not esc|
|00003080| 61 70 65 64 20 2d 20 74 | 68 69 73 20 69 73 0a 66 |aped - t|his is.f|
|00003090| 6f 72 20 63 6f 6d 70 61 | 74 69 62 69 6c 69 74 79 |or compa|tibility|
|000030a0| 20 72 65 61 73 6f 6e 73 | 20 3a 2d 28 20 29 2e 20 | reasons| :-( ). |
|000030b0| 59 6f 75 20 6d 69 67 68 | 74 20 74 68 69 6e 6b 20 |You migh|t think |
|000030c0| 74 68 65 20 6e 61 6d 65 | 20 6f 66 20 74 68 65 20 |the name| of the |
|000030d0| 67 61 6d 65 0a 73 68 6f | 75 6c 64 20 62 65 20 40 |game.sho|uld be @|
|000030e0| 73 61 6d 70 7b 5f 6d 61 | 69 6e 7d 20 61 6e 64 20 |samp{_ma|in} and |
|000030f0| 6e 6f 74 20 40 73 61 6d | 70 7b 6d 61 69 6e 7d 20 |not @sam|p{main} |
|00003100| 2d 20 61 6e 64 20 79 6f | 75 20 61 72 65 20 63 6f |- and yo|u are co|
|00003110| 6d 70 6c 65 74 65 6c 79 | 0a 72 69 67 68 74 2e 20 |mpletely|.right. |
|00003120| 59 6f 75 20 63 61 6e 20 | 75 73 65 20 40 73 61 6d |You can |use @sam|
|00003130| 70 7b 5f 6d 61 69 6e 7d | 20 66 6f 72 20 40 73 61 |p{_main}| for @sa|
|00003140| 6d 70 7b 6d 61 69 6e 7d | 20 61 6e 64 20 40 73 61 |mp{main}| and @sa|
|00003150| 6d 70 7b 5f 65 78 69 74 | 7d 20 66 6f 72 0a 40 73 |mp{_exit|} for.@s|
|00003160| 61 6d 70 7b 65 78 69 74 | 7d 20 2d 20 74 68 65 72 |amp{exit|} - ther|
|00003170| 65 20 61 72 65 20 73 79 | 6d 62 6f 6c 20 72 65 64 |e are sy|mbol red|
|00003180| 69 72 65 63 74 69 6f 6e | 73 20 66 6f 72 20 74 68 |irection|s for th|
|00003190| 65 73 65 20 61 6e 64 20 | 74 68 65 20 6c 69 6e 6b |ese and |the link|
|000031a0| 65 72 0a 64 6f 65 73 20 | 74 68 65 20 77 6f 72 6b |er.does |the work|
|000031b0| 2e 20 0a 0a 54 68 69 73 | 20 63 6f 6d 6d 61 6e 64 |. ..This| command|
|000031c0| 6c 69 6e 65 20 70 61 72 | 73 65 72 20 69 73 20 75 |line par|ser is u|
|000031d0| 73 65 66 75 6c 20 66 6f | 72 20 63 6f 6d 70 61 74 |seful fo|r compat|
|000031e0| 69 62 69 6c 69 74 79 2e | 0a 59 6f 75 20 63 61 6e |ibility.|.You can|
|000031f0| 20 75 73 65 20 69 74 20 | 61 73 20 61 20 73 65 63 | use it |as a sec|
|00003200| 6f 6e 64 20 65 78 61 6d | 70 6c 65 20 6f 72 20 66 |ond exam|ple or f|
|00003210| 6f 72 20 72 65 63 6f 6d | 70 69 6c 69 6e 67 20 50 |or recom|piling P|
|00003220| 44 20 70 72 6f 67 72 61 | 6d 73 20 74 68 61 74 20 |D progra|ms that |
|00003230| 0a 75 73 65 20 74 68 65 | 20 73 69 6e 67 6c 65 20 |.use the| single |
|00003240| 61 72 67 75 6d 65 6e 74 | 2e 20 59 6f 75 20 63 61 |argument|. You ca|
|00003250| 6e 6e 6f 74 20 75 73 65 | 20 69 74 20 66 6f 72 20 |nnot use| it for |
|00003260| 63 6f 6d 70 69 6c 69 6e | 67 20 41 4e 53 49 20 63 |compilin|g ANSI c|
|00003270| 6f 64 65 2e 0a 40 65 6e | 64 20 74 61 62 6c 65 0a |ode..@en|d table.|
|00003280| 0a 40 6e 6f 64 65 20 6c | 69 62 6e 69 78 2e 61 2c |.@node l|ibnix.a,|
|00003290| 6c 69 62 61 6d 69 67 61 | 2e 61 2c 43 6f 6d 6d 61 |libamiga|.a,Comma|
|000032a0| 6e 64 6c 69 6e 65 20 70 | 61 72 73 65 72 2c 46 65 |ndline p|arser,Fe|
|000032b0| 61 74 75 72 65 73 0a 40 | 63 68 61 70 74 65 72 20 |atures.@|chapter |
|000032c0| 53 6f 6d 65 20 41 4e 53 | 49 20 28 6d 69 73 29 66 |Some ANS|I (mis)f|
|000032d0| 65 61 74 75 72 65 73 0a | 0a 49 20 73 75 70 70 6f |eatures.|.I suppo|
|000032e0| 73 65 20 79 6f 75 20 61 | 72 65 20 66 61 6d 69 6c |se you a|re famil|
|000032f0| 69 61 72 20 77 69 74 68 | 20 43 20 61 6e 64 20 65 |iar with| C and e|
|00003300| 73 70 65 63 69 61 6c 6c | 79 20 41 4e 53 49 20 43 |speciall|y ANSI C|
|00003310| 20 2d 20 69 66 20 6e 6f | 74 0a 79 6f 75 20 73 68 | - if no|t.you sh|
|00003320| 6f 75 6c 64 20 72 65 61 | 64 20 61 20 67 6f 6f 64 |ould rea|d a good|
|00003330| 20 62 6f 6f 6b 20 61 62 | 6f 75 74 20 69 74 20 0a | book ab|out it .|
|00003340| 40 66 6f 6f 74 6e 6f 74 | 65 7b 49 20 72 65 63 6f |@footnot|e{I reco|
|00003350| 6d 6d 65 6e 64 20 74 68 | 69 73 20 6f 6e 65 3a 0a |mmend th|is one:.|
|00003360| 0a 42 72 69 61 6e 20 57 | 2e 20 4b 65 72 6e 69 67 |.Brian W|. Kernig|
|00003370| 68 61 6e 2c 20 44 65 6e | 6e 69 73 20 4d 2e 52 69 |han, Den|nis M.Ri|
|00003380| 74 63 68 69 65 3a 0a 40 | 2a 54 68 65 20 43 20 50 |tchie:.@|*The C P|
|00003390| 72 6f 67 72 61 6d 6d 69 | 6e 67 20 4c 61 6e 67 75 |rogrammi|ng Langu|
|000033a0| 61 67 65 20 28 53 65 63 | 6f 6e 64 20 45 64 69 74 |age (Sec|ond Edit|
|000033b0| 69 6f 6e 29 0a 40 2a 50 | 72 65 6e 74 69 63 65 20 |ion).@*P|rentice |
|000033c0| 48 61 6c 6c 2c 20 45 6e | 67 6c 65 77 6f 6f 64 20 |Hall, En|glewood |
|000033d0| 43 6c 69 66 66 73 2c 20 | 31 39 38 38 7d 2e 0a 54 |Cliffs, |1988}..T|
|000033e0| 68 69 73 20 63 68 61 70 | 74 65 72 20 6f 6e 6c 79 |his chap|ter only|
|000033f0| 20 63 6f 6e 74 61 69 6e | 73 20 73 6f 6d 65 20 73 | contain|s some s|
|00003400| 70 65 63 69 61 6c 20 66 | 65 61 74 75 72 65 73 20 |pecial f|eatures |
|00003410| 6f 66 20 74 68 65 0a 69 | 6d 70 6c 65 6d 65 6e 74 |of the.i|mplement|
|00003420| 61 74 69 6f 6e 20 2d 20 | 79 6f 75 20 73 68 6f 75 |ation - |you shou|
|00003430| 6c 64 20 6b 6e 6f 77 20 | 74 68 65 73 65 20 69 66 |ld know |these if|
|00003440| 20 79 6f 75 20 77 61 6e | 74 20 74 6f 0a 75 73 65 | you wan|t to.use|
|00003450| 20 74 68 69 73 20 6c 69 | 62 72 61 72 79 2e 0a 0a | this li|brary...|
|00003460| 40 6d 65 6e 75 0a 2a 20 | 4c 6f 63 61 6c 65 3a 3a |@menu.* |Locale::|
|00003470| 0a 2a 20 46 6f 72 6d 61 | 74 74 65 64 20 49 2f 4f |.* Forma|tted I/O|
|00003480| 3a 3a 0a 2a 20 61 74 6f | 66 20 73 74 72 74 6f 64 |::.* ato|f strtod|
|00003490| 3a 3a 0a 2a 20 4d 65 6d | 6f 72 79 20 6d 61 6e 61 |::.* Mem|ory mana|
|000034a0| 67 65 6d 65 6e 74 3a 3a | 0a 2a 20 53 74 61 6e 64 |gement::|.* Stand|
|000034b0| 61 72 64 20 49 2f 4f 3a | 3a 0a 2a 20 53 69 67 6e |ard I/O:|:.* Sign|
|000034c0| 61 6c 20 68 61 6e 64 6c | 69 6e 67 3a 3a 0a 2a 20 |al handl|ing::.* |
|000034d0| 73 65 74 6a 6d 70 20 6c | 6f 6e 67 6a 6d 70 3a 3a |setjmp l|ongjmp::|
|000034e0| 0a 2a 20 63 74 79 70 65 | 3a 3a 0a 2a 20 63 6c 6f |.* ctype|::.* clo|
|000034f0| 63 6b 3a 3a 0a 2a 20 4d | 75 6c 74 69 62 79 74 65 |ck::.* M|ultibyte|
|00003500| 20 63 68 61 72 61 63 74 | 65 72 20 66 75 6e 63 74 | charact|er funct|
|00003510| 69 6f 6e 73 3a 3a 0a 40 | 65 6e 64 20 6d 65 6e 75 |ions::.@|end menu|
|00003520| 0a 0a 40 6e 6f 64 65 20 | 4c 6f 63 61 6c 65 2c 46 |..@node |Locale,F|
|00003530| 6f 72 6d 61 74 74 65 64 | 20 49 2f 4f 2c 6c 69 62 |ormatted| I/O,lib|
|00003540| 6e 69 78 2e 61 2c 6c 69 | 62 6e 69 78 2e 61 0a 40 |nix.a,li|bnix.a.@|
|00003550| 63 68 61 70 74 65 72 20 | 4c 6f 63 61 6c 65 0a 0a |chapter |Locale..|
|00003560| 4f 6e 65 20 66 65 61 74 | 75 72 65 20 6f 66 20 61 |One feat|ure of a|
|00003570| 20 63 6f 6d 70 6c 65 74 | 65 20 41 4e 53 49 20 63 | complet|e ANSI c|
|00003580| 6f 6d 70 61 74 69 62 6c | 65 20 6c 69 62 72 61 72 |ompatibl|e librar|
|00003590| 79 20 69 73 20 6c 6f 63 | 61 6c 65 20 73 75 70 70 |y is loc|ale supp|
|000035a0| 6f 72 74 2e 20 54 68 65 | 0a 41 4e 53 49 20 73 74 |ort. The|.ANSI st|
|000035b0| 61 6e 64 61 72 64 20 6f | 6e 6c 79 20 6b 6e 6f 77 |andard o|nly know|
|000035c0| 73 20 6f 66 20 74 77 6f | 20 6c 6f 63 61 6c 65 73 |s of two| locales|
|000035d0| 3a 0a 0a 40 69 74 65 6d | 69 7a 65 20 40 62 75 6c |:..@item|ize @bul|
|000035e0| 6c 65 74 0a 40 69 74 65 | 6d 0a 22 43 22 20 6c 6f |let.@ite|m."C" lo|
|000035f0| 63 61 6c 65 20 28 6e 6f | 72 6d 61 6c 20 43 20 62 |cale (no|rmal C b|
|00003600| 65 68 61 76 69 6f 75 72 | 29 2e 0a 40 69 74 65 6d |ehaviour|)..@item|
|00003610| 0a 44 65 66 61 75 6c 74 | 20 6c 6f 63 61 6c 65 2e |.Default| locale.|
|00003620| 0a 40 65 6e 64 20 69 74 | 65 6d 69 7a 65 0a 0a 45 |.@end it|emize..E|
|00003630| 76 65 72 79 20 6f 74 68 | 65 72 20 6c 6f 63 61 6c |very oth|er local|
|00003640| 65 20 64 65 70 65 6e 64 | 73 20 76 65 72 79 20 68 |e depend|s very h|
|00003650| 65 61 76 69 6c 79 20 6f | 6e 20 74 68 65 20 69 6d |eavily o|n the im|
|00003660| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 2e 0a 0a 54 |plementa|tion...T|
|00003670| 6f 20 64 6f 20 6c 6f 63 | 61 6c 65 20 73 75 70 70 |o do loc|ale supp|
|00003680| 6f 72 74 20 6f 6e 20 74 | 68 65 20 61 6d 69 67 61 |ort on t|he amiga|
|00003690| 20 49 20 64 65 63 69 64 | 65 64 20 74 6f 20 75 73 | I decid|ed to us|
|000036a0| 65 20 6c 6f 63 61 6c 65 | 2e 6c 69 62 72 61 72 79 |e locale|.library|
|000036b0| 20 28 77 68 61 74 20 65 | 6c 73 65 29 2e 0a 54 68 | (what e|lse)..Th|
|000036c0| 69 73 20 6d 65 61 6e 73 | 20 74 68 61 74 20 79 6f |is means| that yo|
|000036d0| 75 20 6e 6f 72 6d 61 6c | 6c 79 20 68 61 76 65 20 |u normal|ly have |
|000036e0| 6f 6e 6c 79 20 74 68 65 | 73 65 20 74 77 6f 20 6c |only the|se two l|
|000036f0| 6f 63 61 6c 65 73 20 2d | 20 74 6f 20 68 61 76 65 |ocales -| to have|
|00003700| 20 6d 6f 72 65 20 74 68 | 61 6e 20 74 68 61 74 0a | more th|an that.|
|00003710| 79 6f 75 20 6d 75 73 74 | 20 6d 61 6b 65 20 73 6f |you must| make so|
|00003720| 6d 65 20 65 78 74 72 61 | 20 70 72 65 66 65 72 65 |me extra| prefere|
|00003730| 6e 63 65 73 20 66 69 6c | 65 73 20 77 69 74 68 20 |nces fil|es with |
|00003740| 74 68 65 20 6c 6f 63 61 | 6c 65 20 70 72 65 66 65 |the loca|le prefe|
|00003750| 72 65 6e 63 65 73 20 65 | 64 69 74 6f 72 0a 61 6e |rences e|ditor.an|
|00003760| 64 20 67 69 76 65 20 74 | 68 65 20 70 61 74 68 20 |d give t|he path |
|00003770| 6f 66 20 74 68 65 73 65 | 20 74 6f 20 74 68 65 20 |of these| to the |
|00003780| 73 65 74 6c 6f 63 61 6c | 65 28 29 2d 63 61 6c 6c |setlocal|e()-call|
|00003790| 2e 20 49 66 20 79 6f 75 | 20 64 6f 20 6e 6f 74 20 |. If you| do not |
|000037a0| 68 61 76 65 20 6c 6f 63 | 61 6c 65 2e 6c 69 62 72 |have loc|ale.libr|
|000037b0| 61 72 79 0a 79 6f 75 20 | 77 69 6c 6c 20 67 65 74 |ary.you |will get|
|000037c0| 20 6f 6e 6c 79 20 22 43 | 22 20 6c 6f 63 61 6c 65 | only "C|" locale|
|000037d0| 2e 20 54 68 69 73 20 69 | 73 20 74 68 65 20 64 65 |. This i|s the de|
|000037e0| 66 61 75 6c 74 20 74 68 | 65 6e 20 3a 2d 28 2e 0a |fault th|en :-(..|
|000037f0| 0a 41 6e 6f 74 68 65 72 | 20 69 6d 70 6f 72 74 61 |.Another| importa|
|00003800| 6e 74 20 70 6f 69 6e 74 | 20 69 73 20 74 68 61 74 |nt point| is that|
|00003810| 20 74 68 65 20 41 4e 53 | 49 20 73 74 61 6e 64 61 | the ANS|I standa|
|00003820| 72 64 20 72 65 71 75 69 | 72 65 73 20 74 68 65 20 |rd requi|res the |
|00003830| 64 65 66 61 75 6c 74 20 | 6c 6f 63 61 6c 65 20 74 |default |locale t|
|00003840| 6f 20 62 65 0a 6c 6f 61 | 64 65 64 20 61 74 20 70 |o be.loa|ded at p|
|00003850| 72 6f 67 72 61 6d 20 73 | 74 61 72 74 75 70 2e 20 |rogram s|tartup. |
|00003860| 69 2e 65 2e 20 69 66 20 | 79 6f 75 20 75 73 65 20 |i.e. if |you use |
|00003870| 67 65 72 6d 61 6e 20 6c | 6f 63 61 6c 65 20 28 66 |german l|ocale (f|
|00003880| 6f 72 20 65 78 61 6d 70 | 6c 65 29 20 79 6f 75 20 |or examp|le) you |
|00003890| 0a 77 69 6c 6c 20 6a 75 | 73 74 20 67 65 74 20 69 |.will ju|st get i|
|000038a0| 74 20 2d 20 70 72 69 6e | 74 66 20 61 6e 64 20 73 |t - prin|tf and s|
|000038b0| 63 61 6e 66 20 77 69 6c | 6c 20 6e 6f 74 20 77 6f |canf wil|l not wo|
|000038c0| 72 6b 20 61 73 20 65 78 | 70 65 63 74 65 64 20 62 |rk as ex|pected b|
|000038d0| 75 74 20 75 73 65 20 74 | 68 65 0a 64 65 63 69 6d |ut use t|he.decim|
|000038e0| 61 6c 20 63 6f 6d 6d 61 | 20 40 73 61 6d 70 7b 2c |al comma| @samp{,|
|000038f0| 7d 20 69 6e 73 74 65 61 | 64 20 6f 66 20 74 68 65 |} instea|d of the|
|00003900| 20 64 65 63 69 6d 61 6c | 20 70 6f 69 6e 74 20 40 | decimal| point @|
|00003910| 73 61 6d 70 7b 2e 7d 20 | 66 6f 72 20 74 68 65 69 |samp{.} |for thei|
|00003920| 72 20 66 6c 6f 61 74 69 | 6e 67 20 0a 70 6f 69 6e |r floati|ng .poin|
|00003930| 74 20 6e 75 6d 62 65 72 | 73 2c 20 63 74 79 70 65 |t number|s, ctype|
|00003940| 20 66 75 6e 63 74 69 6f | 6e 73 20 77 69 6c 6c 20 | functio|ns will |
|00003950| 62 65 68 61 76 65 20 64 | 69 66 66 65 72 65 6e 74 |behave d|ifferent|
|00003960| 6c 79 2c 20 74 6f 6f 2e | 0a 0a 54 68 69 73 20 63 |ly, too.|..This c|
|00003970| 61 6e 20 62 65 20 76 65 | 72 79 20 61 6e 6e 6f 79 |an be ve|ry annoy|
|00003980| 69 6e 67 20 69 66 20 79 | 6f 75 20 64 6f 6e 27 74 |ing if y|ou don't|
|00003990| 20 77 61 6e 74 20 74 6f | 20 75 73 65 20 41 4e 53 | want to| use ANS|
|000039a0| 49 20 6c 6f 63 61 6c 65 | 20 62 75 74 20 72 61 74 |I locale| but rat|
|000039b0| 68 65 72 0a 6c 6f 63 61 | 6c 65 2e 6c 69 62 72 61 |her.loca|le.libra|
|000039c0| 72 79 20 28 77 68 69 63 | 68 20 69 73 20 6e 6f 74 |ry (whic|h is not|
|000039d0| 20 70 6f 72 74 61 62 6c | 65 20 62 75 74 20 49 4d | portabl|e but IM|
|000039e0| 48 4f 20 6d 75 63 68 20 | 62 65 74 74 65 72 29 20 |HO much |better) |
|000039f0| 6f 72 20 69 66 0a 79 6f | 75 20 64 6f 6e 27 74 20 |or if.yo|u don't |
|00003a00| 6e 65 65 64 20 6c 6f 63 | 61 6c 65 20 73 75 70 70 |need loc|ale supp|
|00003a10| 6f 72 74 2e 20 41 6e 64 | 20 65 76 65 6e 20 64 61 |ort. And| even da|
|00003a20| 6e 67 65 72 6f 75 73 20 | 69 66 20 79 6f 75 20 64 |ngerous |if you d|
|00003a30| 6f 6e 27 74 0a 74 65 73 | 74 20 79 6f 75 72 20 70 |on't.tes|t your p|
|00003a40| 72 6f 67 72 61 6d 20 75 | 6e 64 65 72 20 64 69 66 |rogram u|nder dif|
|00003a50| 66 65 72 65 6e 74 20 6c | 6f 63 61 6c 65 73 2e 0a |ferent l|ocales..|
|00003a60| 0a 54 6f 20 67 65 74 20 | 61 72 6f 75 6e 64 20 74 |.To get |around t|
|00003a70| 68 69 73 20 70 72 6f 62 | 6c 65 6d 20 49 20 64 65 |his prob|lem I de|
|00003a80| 63 69 64 65 64 20 74 6f | 20 64 6f 20 73 6f 6d 65 |cided to| do some|
|00003a90| 20 6e 61 73 74 79 20 74 | 68 69 6e 67 3a 0a 54 6f | nasty t|hing:.To|
|00003aa0| 20 67 65 74 20 6c 6f 63 | 61 6c 65 20 73 75 70 70 | get loc|ale supp|
|00003ab0| 6f 72 74 20 79 6f 75 20 | 68 61 76 65 20 74 6f 20 |ort you |have to |
|00003ac0| 6d 61 6b 65 20 75 70 20 | 61 20 72 65 66 65 72 65 |make up |a refere|
|00003ad0| 6e 63 65 20 74 6f 20 73 | 65 74 6c 6f 63 61 6c 65 |nce to s|etlocale|
|00003ae0| 2e 20 59 6f 75 20 63 61 | 6e 20 64 6f 0a 74 68 69 |. You ca|n do.thi|
|00003af0| 73 20 62 79 20 6a 75 73 | 74 20 63 61 6c 6c 69 6e |s by jus|t callin|
|00003b00| 67 20 0a 0a 73 65 74 6c | 6f 63 61 6c 65 28 4c 43 |g ..setl|ocale(LC|
|00003b10| 5f 41 4c 4c 2c 22 43 22 | 29 3b 0a 0a 69 6d 6d 65 |_ALL,"C"|);..imme|
|00003b20| 64 69 61 74 65 6c 79 20 | 61 66 74 65 72 20 70 72 |diately |after pr|
|00003b30| 6f 67 72 61 6d 20 73 74 | 61 72 74 75 70 2e 20 28 |ogram st|artup. (|
|00003b40| 41 6e 64 20 67 65 74 20 | 22 43 22 20 6c 6f 63 61 |And get |"C" loca|
|00003b50| 6c 65 20 74 68 65 6e 20 | 61 66 74 65 72 20 70 72 |le then |after pr|
|00003b60| 6f 67 72 61 6d 20 73 74 | 61 72 74 20 77 68 69 63 |ogram st|art whic|
|00003b70| 68 0a 69 73 20 61 20 6d | 75 63 68 20 62 65 74 74 |h.is a m|uch bett|
|00003b80| 65 72 20 63 68 6f 69 63 | 65 29 2e 20 4f 72 20 62 |er choic|e). Or b|
|00003b90| 79 20 6a 75 73 74 20 75 | 73 69 6e 67 20 73 65 74 |y just u|sing set|
|00003ba0| 6c 6f 63 61 6c 65 20 61 | 6e 79 77 68 65 72 65 20 |locale a|nywhere |
|00003bb0| 69 6e 20 79 6f 75 72 20 | 70 72 6f 67 72 61 6d 20 |in your |program |
|00003bc0| 2d 0a 79 6f 75 20 77 69 | 6c 6c 20 67 65 74 20 64 |-.you wi|ll get d|
|00003bd0| 65 66 61 75 6c 74 20 6c | 6f 63 61 6c 65 20 61 74 |efault l|ocale at|
|00003be0| 20 70 72 6f 67 72 61 6d | 20 73 74 61 72 74 75 70 | program| startup|
|00003bf0| 20 74 68 65 6e 2e 0a 0a | 40 6e 6f 64 65 20 46 6f | then...|@node Fo|
|00003c00| 72 6d 61 74 74 65 64 20 | 49 2f 4f 2c 61 74 6f 66 |rmatted |I/O,atof|
|00003c10| 20 73 74 72 74 6f 64 2c | 4c 6f 63 61 6c 65 2c 6c | strtod,|Locale,l|
|00003c20| 69 62 6e 69 78 2e 61 0a | 40 63 68 61 70 74 65 72 |ibnix.a.|@chapter|
|00003c30| 20 46 6f 72 6d 61 74 74 | 65 64 20 49 2f 4f 0a 0a | Formatt|ed I/O..|
|00003c40| 54 68 65 20 66 6f 72 6d | 61 74 74 65 64 20 49 2f |The form|atted I/|
|00003c50| 4f 20 73 70 65 63 69 66 | 69 63 61 74 69 6f 6e 73 |O specif|ications|
|00003c60| 20 61 72 65 20 61 6c 6c | 20 74 68 65 72 65 20 28 | are all| there (|
|00003c70| 72 65 6d 65 6d 62 65 72 | 3a 20 74 68 69 73 20 6c |remember|: this l|
|00003c80| 69 62 72 61 72 79 20 74 | 72 69 65 73 20 74 6f 0a |ibrary t|ries to.|
|00003c90| 62 65 20 41 4e 53 49 20 | 63 6f 6d 70 6c 69 61 6e |be ANSI |complian|
|00003ca0| 74 29 2e 20 42 75 74 20 | 74 68 65 72 65 20 61 72 |t). But |there ar|
|00003cb0| 65 20 74 77 6f 20 74 68 | 69 6e 67 73 20 79 6f 75 |e two th|ings you|
|00003cc0| 20 73 68 6f 75 6c 64 20 | 6b 6e 6f 77 20 61 62 6f | should |know abo|
|00003cd0| 75 74 20 74 68 65 6d 3a | 0a 0a 40 69 74 65 6d 69 |ut them:|..@itemi|
|00003ce0| 7a 65 20 40 62 75 6c 6c | 65 74 0a 40 69 74 65 6d |ze @bull|et.@item|
|00003cf0| 0a 54 68 65 20 66 6f 72 | 6d 61 74 74 65 64 20 49 |.The for|matted I|
|00003d00| 2f 4f 20 69 73 20 61 66 | 66 65 63 74 65 64 20 62 |/O is af|fected b|
|00003d10| 79 20 74 68 65 20 73 65 | 74 6c 6f 63 61 6c 65 28 |y the se|tlocale(|
|00003d20| 29 20 63 61 6c 6c 20 2d | 20 74 68 69 73 20 69 73 |) call -| this is|
|00003d30| 20 6e 6f 20 62 75 67 2c | 0a 6a 75 73 74 20 61 6e | no bug,|.just an|
|00003d40| 20 41 4e 53 49 20 66 65 | 61 74 75 72 65 2e 0a 40 | ANSI fe|ature..@|
|00003d50| 69 74 65 6d 0a 48 61 6c | 66 20 6f 66 20 74 68 65 |item.Hal|f of the|
|00003d60| 20 63 6f 64 65 20 6f 66 | 20 61 20 66 75 6c 6c 20 | code of| a full |
|00003d70| 62 6c 6f 77 6e 20 70 72 | 69 6e 74 66 20 68 61 6e |blown pr|intf han|
|00003d80| 64 6c 65 73 20 66 6c 6f | 61 74 69 6e 67 20 70 6f |dles flo|ating po|
|00003d90| 69 6e 74 20 6e 75 6d 62 | 65 72 73 20 2d 0a 62 75 |int numb|ers -.bu|
|00003da0| 74 20 6e 6f 74 20 65 76 | 65 72 79 62 6f 64 79 20 |t not ev|erybody |
|00003db0| 6e 65 65 64 73 20 74 68 | 65 6d 2e 20 53 6f 20 74 |needs th|em. So t|
|00003dc0| 68 65 72 65 20 61 72 65 | 20 74 77 6f 20 66 75 6e |here are| two fun|
|00003dd0| 63 74 69 6f 6e 73 20 66 | 6f 72 20 62 6f 74 68 0a |ctions f|or both.|
|00003de0| 40 73 61 6d 70 7b 76 66 | 70 72 69 6e 74 66 7d 20 |@samp{vf|printf} |
|00003df0| 61 6e 64 20 40 73 61 6d | 70 7b 76 66 73 63 61 6e |and @sam|p{vfscan|
|00003e00| 66 7d 20 2d 20 6f 6e 65 | 20 69 6e 20 40 73 61 6d |f} - one| in @sam|
|00003e10| 70 7b 6c 69 62 6e 69 78 | 2e 61 7d 20 6e 6f 74 20 |p{libnix|.a} not |
|00003e20| 69 6e 63 6c 75 64 69 6e | 67 0a 66 6c 6f 61 74 69 |includin|g.floati|
|00003e30| 6e 67 20 70 6f 69 6e 74 | 20 73 75 70 70 6f 72 74 |ng point| support|
|00003e40| 20 61 6e 64 20 6f 6e 65 | 20 69 6e 20 40 73 61 6d | and one| in @sam|
|00003e50| 70 7b 6c 69 62 6d 2e 61 | 7d 20 69 6e 63 6c 75 64 |p{libm.a|} includ|
|00003e60| 69 6e 67 20 66 6c 6f 61 | 74 69 6e 67 0a 70 6f 69 |ing floa|ting.poi|
|00003e70| 6e 74 20 73 75 70 70 6f | 72 74 2e 0a 0a 53 6f 20 |nt suppo|rt...So |
|00003e80| 69 66 20 79 6f 75 20 77 | 61 6e 74 20 74 6f 20 75 |if you w|ant to u|
|00003e90| 73 65 20 6f 6e 65 20 6f | 66 20 74 68 65 20 66 6f |se one o|f the fo|
|00003ea0| 72 6d 61 74 74 65 64 20 | 49 2f 4f 20 73 70 65 63 |rmatted |I/O spec|
|00003eb0| 69 66 69 65 72 73 20 66 | 6f 72 20 66 6c 6f 61 74 |ifiers f|or float|
|00003ec0| 73 0a 79 6f 75 20 73 68 | 6f 75 6c 64 20 6c 69 6e |s.you sh|ould lin|
|00003ed0| 6b 20 77 69 74 68 20 74 | 68 65 20 6d 61 74 68 20 |k with t|he math |
|00003ee0| 6c 69 62 72 61 72 79 20 | 40 73 61 6d 70 7b 2d 6c |library |@samp{-l|
|00003ef0| 6d 7d 2e 0a 40 65 6e 64 | 20 69 74 65 6d 69 7a 65 |m}..@end| itemize|
|00003f00| 0a 0a 40 6e 6f 64 65 20 | 61 74 6f 66 20 73 74 72 |..@node |atof str|
|00003f10| 74 6f 64 2c 4d 65 6d 6f | 72 79 20 6d 61 6e 61 67 |tod,Memo|ry manag|
|00003f20| 65 6d 65 6e 74 2c 46 6f | 72 6d 61 74 74 65 64 20 |ement,Fo|rmatted |
|00003f30| 49 2f 4f 2c 6c 69 62 6e | 69 78 2e 61 0a 40 63 68 |I/O,libn|ix.a.@ch|
|00003f40| 61 70 74 65 72 20 61 74 | 6f 66 20 73 74 72 74 6f |apter at|of strto|
|00003f50| 64 0a 0a 54 68 65 20 74 | 77 6f 20 66 75 6e 63 74 |d..The t|wo funct|
|00003f60| 69 6f 6e 73 20 40 73 61 | 6d 70 7b 61 74 6f 66 7d |ions @sa|mp{atof}|
|00003f70| 20 61 6e 64 20 40 73 61 | 6d 70 7b 73 74 72 74 6f | and @sa|mp{strto|
|00003f80| 64 7d 20 72 65 71 75 69 | 72 65 20 61 20 77 6f 72 |d} requi|re a wor|
|00003f90| 6b 69 6e 67 0a 40 73 61 | 6d 70 7b 25 66 7d 20 73 |king.@sa|mp{%f} s|
|00003fa0| 70 65 63 69 66 69 65 72 | 20 69 6e 20 40 73 61 6d |pecifier| in @sam|
|00003fb0| 70 7b 76 66 73 63 61 6e | 66 7d 20 2d 20 74 68 65 |p{vfscan|f} - the|
|00003fc0| 72 65 66 6f 72 65 20 74 | 68 65 79 0a 72 65 71 75 |refore t|hey.requ|
|00003fd0| 69 72 65 20 74 68 65 20 | 66 6f 72 6d 61 74 74 65 |ire the |formatte|
|00003fe0| 64 20 49 2f 4f 20 66 75 | 6e 63 74 69 6f 6e 73 20 |d I/O fu|nctions |
|00003ff0| 69 6e 20 74 68 65 20 6d | 61 74 68 20 6c 69 62 72 |in the m|ath libr|
|00004000| 61 72 79 2e 0a 53 69 6e | 63 65 20 40 73 61 6d 70 |ary..Sin|ce @samp|
|00004010| 7b 6c 69 62 6d 2e 61 7d | 20 69 73 20 6c 69 6e 6b |{libm.a}| is link|
|00004020| 65 64 20 62 65 66 6f 72 | 65 20 40 73 61 6d 70 7b |ed befor|e @samp{|
|00004030| 6c 69 62 6e 69 78 2e 61 | 7d 20 74 68 65 73 65 0a |libnix.a|} these.|
|00004040| 74 77 6f 20 66 75 6e 63 | 74 69 6f 6e 73 20 68 61 |two func|tions ha|
|00004050| 76 65 20 62 65 65 6e 20 | 67 6f 6e 65 20 69 6e 74 |ve been |gone int|
|00004060| 6f 20 74 68 65 20 6d 61 | 74 68 20 6c 69 62 72 61 |o the ma|th libra|
|00004070| 72 79 2e 0a 0a 40 6e 6f | 64 65 20 4d 65 6d 6f 72 |ry...@no|de Memor|
|00004080| 79 20 6d 61 6e 61 67 65 | 6d 65 6e 74 2c 53 74 61 |y manage|ment,Sta|
|00004090| 6e 64 61 72 64 20 49 2f | 4f 2c 61 74 6f 66 20 73 |ndard I/|O,atof s|
|000040a0| 74 72 74 6f 64 2c 6c 69 | 62 6e 69 78 2e 61 0a 40 |trtod,li|bnix.a.@|
|000040b0| 63 68 61 70 74 65 72 20 | 4d 65 6d 6f 72 79 20 6d |chapter |Memory m|
|000040c0| 61 6e 61 67 65 6d 65 6e | 74 0a 0a 4d 6f 73 74 20 |anagemen|t..Most |
|000040d0| 6f 66 20 74 68 65 20 6d | 65 6d 6f 72 79 20 6d 61 |of the m|emory ma|
|000040e0| 6e 61 67 65 6d 65 6e 74 | 20 6f 66 20 74 68 69 73 |nagement| of this|
|000040f0| 20 6c 69 62 72 61 72 79 | 20 72 75 6e 73 20 74 68 | library| runs th|
|00004100| 72 6f 75 67 68 20 6d 61 | 6c 6c 6f 63 28 29 2e 0a |rough ma|lloc()..|
|00004110| 4f 6e 6c 79 20 74 68 65 | 20 63 6f 6d 6d 61 6e 64 |Only the| command|
|00004120| 6c 69 6e 65 20 70 61 72 | 73 65 72 20 75 73 65 73 |line par|ser uses|
|00004130| 20 41 6c 6c 6f 63 56 65 | 63 28 29 20 2d 20 73 6f | AllocVe|c() - so|
|00004140| 20 79 6f 75 20 63 61 6e | 20 75 73 65 20 69 74 20 | you can| use it |
|00004150| 77 69 74 68 6f 75 74 0a | 68 61 76 69 6e 67 20 74 |without.|having t|
|00004160| 68 65 20 6d 61 6c 6c 6f | 63 20 66 75 6e 63 74 69 |he mallo|c functi|
|00004170| 6f 6e 20 73 6f 6d 65 77 | 65 72 65 20 69 6e 20 79 |on somew|ere in y|
|00004180| 6f 75 72 20 70 72 6f 67 | 72 61 6d 2e 0a 0a 54 68 |our prog|ram...Th|
|00004190| 65 20 6d 65 6d 6f 72 79 | 20 6d 61 6e 61 67 65 6d |e memory| managem|
|000041a0| 65 6e 74 20 75 73 65 73 | 20 61 20 6c 6f 63 61 6c |ent uses| a local|
|000041b0| 20 28 74 6f 20 74 68 69 | 73 20 74 61 73 6b 29 20 | (to thi|s task) |
|000041c0| 6d 65 6d 6f 72 79 20 70 | 6f 6f 6c 20 74 6f 20 72 |memory p|ool to r|
|000041d0| 65 64 75 63 65 0a 6d 65 | 6d 6f 72 79 20 66 72 61 |educe.me|mory fra|
|000041e0| 67 6d 65 6e 74 61 74 69 | 6f 6e 2e 20 49 74 20 75 |gmentati|on. It u|
|000041f0| 73 65 73 20 74 68 65 20 | 73 79 73 74 65 6d 20 66 |ses the |system f|
|00004200| 75 6e 63 74 69 6f 6e 73 | 20 74 6f 20 64 6f 20 73 |unctions| to do s|
|00004210| 6f 20 28 6e 6f 74 20 74 | 68 65 0a 6e 65 77 20 70 |o (not t|he.new p|
|00004220| 6f 6f 6c 65 64 20 6d 65 | 6d 6f 72 79 20 66 75 6e |ooled me|mory fun|
|00004230| 63 74 69 6f 6e 73 20 62 | 75 74 20 6a 75 73 74 20 |ctions b|ut just |
|00004240| 74 68 65 20 6f 6c 64 65 | 72 20 41 6c 6c 6f 63 61 |the olde|r Alloca|
|00004250| 74 65 28 29 2c 20 44 65 | 61 6c 6c 6f 63 61 74 65 |te(), De|allocate|
|00004260| 28 29 20 70 61 69 72 0a | 77 68 69 63 68 20 61 72 |() pair.|which ar|
|00004270| 65 20 74 68 65 20 3c 33 | 2e 30 20 66 61 6c 6c 62 |e the <3|.0 fallb|
|00004280| 61 63 6b 20 66 6f 72 20 | 6c 69 62 61 6d 69 67 61 |ack for |libamiga|
|00004290| 2e 61 27 73 20 70 6f 6f | 6c 65 64 20 6d 65 6d 6f |.a's poo|led memo|
|000042a0| 72 79 20 66 75 6e 63 74 | 69 6f 6e 73 2c 20 74 6f |ry funct|ions, to|
|000042b0| 6f 29 0a 73 6f 20 74 68 | 65 72 65 20 73 68 6f 75 |o).so th|ere shou|
|000042c0| 6c 64 20 62 65 20 6e 6f | 20 70 72 6f 62 6c 65 6d |ld be no| problem|
|000042d0| 73 20 77 69 74 68 20 69 | 74 20 2d 20 74 68 65 73 |s with i|t - thes|
|000042e0| 65 20 66 75 6e 63 74 69 | 6f 6e 73 20 61 72 65 20 |e functi|ons are |
|000042f0| 74 65 73 74 65 64 20 76 | 65 72 79 20 67 6f 6f 64 |tested v|ery good|
|00004300| 2e 0a 0a 54 68 65 20 64 | 65 66 61 75 6c 74 20 62 |...The d|efault b|
|00004310| 6c 6f 63 6b 73 69 7a 65 | 20 66 6f 72 20 6d 65 6d |locksize| for mem|
|00004320| 6f 72 79 20 61 6c 6c 6f | 63 61 74 69 6f 6e 73 20 |ory allo|cations |
|00004330| 69 73 20 31 36 33 38 34 | 20 62 79 74 65 73 20 2d |is 16384| bytes -|
|00004340| 20 65 71 75 69 76 61 6c | 65 6e 74 0a 74 6f 20 34 | equival|ent.to 4|
|00004350| 20 4d 4d 55 20 70 61 67 | 65 73 2e 20 42 69 67 67 | MMU pag|es. Bigg|
|00004360| 65 72 20 61 6c 6c 6f 63 | 61 74 69 6f 6e 73 20 61 |er alloc|ations a|
|00004370| 72 65 20 62 6c 6f 77 6e | 20 75 70 20 74 6f 20 61 |re blown| up to a|
|00004380| 20 6d 75 6c 74 69 70 6c | 65 20 6f 66 20 34 30 39 | multipl|e of 409|
|00004390| 36 20 62 79 74 65 73 2e | 0a 53 6f 20 64 6f 6e 27 |6 bytes.|.So don'|
|000043a0| 74 20 62 65 20 61 6c 61 | 72 6d 65 64 20 69 66 20 |t be ala|rmed if |
|000043b0| 79 6f 75 72 20 70 72 6f | 67 72 61 6d 20 75 73 65 |your pro|gram use|
|000043c0| 73 20 6d 6f 72 65 20 6d | 65 6d 6f 72 79 20 74 68 |s more m|emory th|
|000043d0| 65 6e 20 65 78 70 65 63 | 74 65 64 2e 0a 0a 49 66 |en expec|ted...If|
|000043e0| 20 79 6f 75 20 64 6f 6e | 27 74 20 6c 69 6b 65 20 | you don|'t like |
|000043f0| 74 68 69 73 20 76 61 6c | 75 65 20 28 69 66 20 79 |this val|ue (if y|
|00004400| 6f 75 20 75 73 65 20 62 | 69 67 67 65 72 20 70 6f |ou use b|igger po|
|00004410| 72 74 69 6f 6e 73 20 66 | 72 65 71 75 65 6e 74 6c |rtions f|requentl|
|00004420| 79 20 6f 72 20 6f 6e 6c | 79 0a 75 73 65 20 76 65 |y or onl|y.use ve|
|00004430| 72 79 20 6c 69 74 74 6c | 65 20 6d 65 6d 6f 72 79 |ry littl|e memory|
|00004440| 29 20 79 6f 75 20 63 61 | 6e 20 72 65 70 6c 61 63 |) you ca|n replac|
|00004450| 65 20 69 74 20 62 79 20 | 64 65 63 6c 61 72 69 6e |e it by |declarin|
|00004460| 67 0a 0a 40 63 6f 64 65 | 7b 75 6e 73 69 67 6e 65 |g..@code|{unsigne|
|00004470| 64 20 6c 6f 6e 67 20 5f | 4d 53 54 45 50 7d 0a 0a |d long _|MSTEP}..|
|00004480| 59 6f 75 20 73 68 6f 75 | 6c 64 20 75 73 65 20 61 |You shou|ld use a|
|00004490| 20 6d 75 6c 74 69 70 6c | 65 20 6f 66 20 4d 4d 55 | multipl|e of MMU|
|000044a0| 20 70 61 67 65 73 2e 20 | 49 66 20 79 6f 75 20 64 | pages. |If you d|
|000044b0| 6f 6e 27 74 20 75 73 65 | 20 61 20 66 75 6c 6c 20 |on't use| a full |
|000044c0| 4d 4d 55 20 70 61 67 65 | 0a 79 6f 75 20 67 61 69 |MMU page|.you gai|
|000044d0| 6e 20 6e 6f 74 68 69 6e | 67 20 2d 20 6d 61 6c 6c |n nothin|g - mall|
|000044e0| 6f 63 20 72 6f 75 6e 64 | 73 20 75 70 20 61 6e 79 |oc round|s up any|
|000044f0| 77 61 79 2e 0a 0a 40 6e | 6f 64 65 20 53 74 61 6e |way...@n|ode Stan|
|00004500| 64 61 72 64 20 49 2f 4f | 2c 53 69 67 6e 61 6c 20 |dard I/O|,Signal |
|00004510| 68 61 6e 64 6c 69 6e 67 | 2c 4d 65 6d 6f 72 79 20 |handling|,Memory |
|00004520| 6d 61 6e 61 67 65 6d 65 | 6e 74 2c 6c 69 62 6e 69 |manageme|nt,libni|
|00004530| 78 2e 61 0a 40 63 68 61 | 70 74 65 72 20 53 74 61 |x.a.@cha|pter Sta|
|00004540| 6e 64 61 72 64 20 49 2f | 4f 20 2d 20 77 68 65 72 |ndard I/|O - wher|
|00004550| 65 20 73 74 64 69 6e 2c | 20 73 74 64 6f 75 74 2c |e stdin,| stdout,|
|00004560| 20 73 74 64 65 72 72 20 | 63 6f 6d 65 20 66 72 6f | stderr |come fro|
|00004570| 6d 0a 0a 32 20 6f 66 20 | 74 68 65 20 33 20 73 74 |m..2 of |the 3 st|
|00004580| 61 6e 64 61 72 64 20 49 | 2f 4f 20 73 74 72 65 61 |andard I|/O strea|
|00004590| 6d 73 20 61 72 65 20 6e | 6f 20 72 65 61 6c 20 70 |ms are n|o real p|
|000045a0| 72 6f 62 6c 65 6d 3a 0a | 0a 40 69 74 65 6d 69 7a |roblem:.|.@itemiz|
|000045b0| 65 20 40 62 75 6c 6c 65 | 74 0a 40 69 74 65 6d 0a |e @bulle|t.@item.|
|000045c0| 40 73 61 6d 70 7b 73 74 | 64 69 6e 7d 20 69 73 20 |@samp{st|din} is |
|000045d0| 73 65 74 20 74 6f 20 74 | 68 65 20 76 61 6c 75 65 |set to t|he value|
|000045e0| 20 74 68 65 20 40 73 61 | 6d 70 7b 49 6e 70 75 74 | the @sa|mp{Input|
|000045f0| 28 29 7d 20 66 75 6e 63 | 74 69 6f 6e 20 6f 66 20 |()} func|tion of |
|00004600| 40 73 61 6d 70 7b 64 6f | 73 2e 6c 69 62 72 61 72 |@samp{do|s.librar|
|00004610| 79 7d 0a 73 65 72 76 65 | 73 2c 0a 40 69 74 65 6d |y}.serve|s,.@item|
|00004620| 0a 40 73 61 6d 70 7b 73 | 74 64 6f 75 74 7d 20 69 |.@samp{s|tdout} i|
|00004630| 73 20 73 65 74 20 74 6f | 20 74 68 65 20 40 73 61 |s set to| the @sa|
|00004640| 6d 70 7b 4f 75 74 70 75 | 74 28 29 7d 20 76 61 6c |mp{Outpu|t()} val|
|00004650| 75 65 2e 0a 40 65 6e 64 | 20 69 74 65 6d 69 7a 65 |ue..@end| itemize|
|00004660| 0a 0a 42 6f 74 68 20 73 | 74 72 65 61 6d 73 20 61 |..Both s|treams a|
|00004670| 72 65 20 6d 61 6e 61 67 | 65 64 20 62 79 20 74 68 |re manag|ed by th|
|00004680| 65 20 4f 53 20 61 6e 64 | 20 74 68 65 20 6c 69 62 |e OS and| the lib|
|00004690| 72 61 72 79 20 6e 65 65 | 64 20 6e 6f 74 20 74 61 |rary nee|d not ta|
|000046a0| 6b 65 20 6d 75 63 68 0a | 63 61 72 65 20 61 62 6f |ke much.|care abo|
|000046b0| 75 74 20 74 68 65 6d 2e | 20 42 75 74 20 40 73 61 |ut them.| But @sa|
|000046c0| 6d 70 7b 73 74 64 65 72 | 72 7d 20 69 73 20 61 20 |mp{stder|r} is a |
|000046d0| 64 69 66 66 65 72 65 6e | 74 20 74 68 69 6e 67 20 |differen|t thing |
|000046e0| 73 69 6e 63 65 0a 74 68 | 65 72 65 20 69 73 20 6e |since.th|ere is n|
|000046f0| 6f 20 40 73 61 6d 70 7b | 45 72 72 70 75 74 28 29 |o @samp{|Errput()|
|00004700| 7d 20 3b 2d 29 20 66 75 | 6e 63 74 69 6f 6e 2e 20 |} ;-) fu|nction. |
|00004710| 53 6f 20 40 73 61 6d 70 | 7b 73 74 64 65 72 72 7d |So @samp|{stderr}|
|00004720| 20 69 73 20 68 61 6e 64 | 6c 65 64 0a 61 73 20 66 | is hand|led.as f|
|00004730| 6f 6c 6c 6f 77 73 3a 0a | 0a 40 65 6e 75 6d 65 72 |ollows:.|.@enumer|
|00004740| 61 74 65 0a 40 69 74 65 | 6d 0a 49 66 20 40 73 61 |ate.@ite|m.If @sa|
|00004750| 6d 70 7b 70 72 6f 63 65 | 73 73 2d 3e 70 72 5f 43 |mp{proce|ss->pr_C|
|00004760| 45 53 7d 20 69 73 20 73 | 65 74 2c 20 74 68 69 73 |ES} is s|et, this|
|00004770| 20 76 61 6c 75 65 20 69 | 73 20 74 61 6b 65 6e 2e | value i|s taken.|
|00004780| 20 54 68 65 72 65 20 61 | 72 65 20 6e 6f 74 0a 6d | There a|re not.m|
|00004790| 75 63 68 20 73 68 65 6c | 6c 73 20 74 68 61 74 20 |uch shel|ls that |
|000047a0| 73 65 74 20 74 68 69 73 | 20 76 61 6c 75 65 20 73 |set this| value s|
|000047b0| 6f 20 6d 6f 73 74 20 6f | 66 20 74 68 65 20 74 69 |o most o|f the ti|
|000047c0| 6d 65 20 74 68 69 73 20 | 6c 65 61 64 73 20 74 6f |me this |leads to|
|000047d0| 20 4e 55 4c 4c 2e 0a 40 | 69 74 65 6d 0a 49 66 20 | NULL..@|item.If |
|000047e0| 74 68 69 73 20 64 69 64 | 6e 27 74 20 77 6f 72 6b |this did|n't work|
|000047f0| 20 61 6e 64 20 79 6f 75 | 72 20 70 72 6f 67 72 61 | and you|r progra|
|00004800| 6d 20 77 61 73 20 73 74 | 61 72 74 65 64 20 66 72 |m was st|arted fr|
|00004810| 6f 6d 20 43 4c 49 20 74 | 68 65 20 6c 69 62 72 61 |om CLI t|he libra|
|00004820| 72 79 0a 6f 70 65 6e 73 | 20 40 73 61 6d 70 7b 4f |ry.opens| @samp{O|
|00004830| 70 65 6e 28 22 2a 22 2c | 4d 4f 44 45 5f 4e 45 57 |pen("*",|MODE_NEW|
|00004840| 46 49 4c 45 29 7d 2e 0a | 54 68 69 73 20 6f 70 65 |FILE)}..|This ope|
|00004850| 6e 73 20 74 68 65 20 6c | 61 73 74 20 69 6e 74 65 |ns the l|ast inte|
|00004860| 72 61 63 74 69 76 65 20 | 74 65 72 6d 69 6e 61 6c |ractive |terminal|
|00004870| 20 61 74 74 61 63 68 65 | 64 20 74 6f 20 73 74 64 | attache|d to std|
|00004880| 6f 75 74 2c 20 69 2e 65 | 2e 0a 69 66 20 79 6f 75 |out, i.e|..if you|
|00004890| 20 75 73 65 20 74 68 65 | 20 6e 6f 72 6d 61 6c 20 | use the| normal |
|000048a0| 41 6d 69 67 61 20 73 68 | 65 6c 6c 20 61 6e 64 20 |Amiga sh|ell and |
|000048b0| 72 65 64 69 72 65 63 74 | 20 79 6f 75 72 20 6f 75 |redirect| your ou|
|000048c0| 74 70 75 74 20 74 6f 20 | 61 20 66 69 6c 65 20 79 |tput to |a file y|
|000048d0| 6f 75 20 0a 67 65 74 20 | 74 68 65 20 74 65 72 6d |ou .get |the term|
|000048e0| 69 6e 61 6c 2c 20 69 66 | 20 79 6f 75 20 72 65 64 |inal, if| you red|
|000048f0| 69 72 65 63 74 20 79 6f | 75 72 20 6f 75 74 70 75 |irect yo|ur outpu|
|00004900| 74 20 74 6f 20 40 73 61 | 6d 70 7b 4e 49 4c 3a 7d |t to @sa|mp{NIL:}|
|00004910| 20 79 6f 75 20 67 65 74 | 20 40 73 61 6d 70 7b 4e | you get| @samp{N|
|00004920| 49 4c 3a 7d 2e 0a 40 69 | 74 65 6d 0a 49 66 20 74 |IL:}..@i|tem.If t|
|00004930| 68 69 73 20 64 69 64 6e | 27 74 20 77 6f 72 6b 20 |his didn|'t work |
|00004940| 74 6f 6f 20 28 79 6f 75 | 20 6e 65 76 65 72 20 6b |too (you| never k|
|00004950| 6e 6f 77 29 20 6f 72 20 | 79 6f 75 72 20 70 72 6f |now) or |your pro|
|00004960| 67 72 61 6d 20 77 61 73 | 20 73 74 61 72 74 65 64 |gram was| started|
|00004970| 20 66 72 6f 6d 20 57 42 | 0a 79 6f 75 20 73 69 6d | from WB|.you sim|
|00004980| 70 6c 79 20 67 65 74 20 | 74 68 65 20 73 61 6d 65 |ply get |the same|
|00004990| 20 73 74 72 65 61 6d 20 | 61 73 20 69 6e 20 40 73 | stream |as in @s|
|000049a0| 61 6d 70 7b 73 74 64 6f | 75 74 7d 2e 0a 40 65 6e |amp{stdo|ut}..@en|
|000049b0| 64 20 65 6e 75 6d 65 72 | 61 74 65 0a 0a 40 6e 6f |d enumer|ate..@no|
|000049c0| 64 65 20 53 69 67 6e 61 | 6c 20 68 61 6e 64 6c 69 |de Signa|l handli|
|000049d0| 6e 67 2c 73 65 74 6a 6d | 70 20 6c 6f 6e 67 6a 6d |ng,setjm|p longjm|
|000049e0| 70 2c 53 74 61 6e 64 61 | 72 64 20 49 2f 4f 2c 6c |p,Standa|rd I/O,l|
|000049f0| 69 62 6e 69 78 2e 61 0a | 40 63 68 61 70 74 65 72 |ibnix.a.|@chapter|
|00004a00| 20 53 69 67 6e 61 6c 20 | 68 61 6e 64 6c 69 6e 67 | Signal |handling|
|00004a10| 0a 0a 54 68 65 72 65 20 | 69 73 20 6f 6e 6c 79 20 |..There |is only |
|00004a20| 73 75 70 70 6f 72 74 20 | 66 6f 72 20 74 68 65 20 |support |for the |
|00004a30| 74 77 6f 20 73 69 67 6e | 61 6c 73 20 53 49 47 41 |two sign|als SIGA|
|00004a40| 42 52 54 20 61 6e 64 20 | 53 49 47 49 4e 54 2e 20 |BRT and |SIGINT. |
|00004a50| 54 68 65 20 6c 69 62 72 | 61 72 79 0a 6b 6e 6f 77 |The libr|ary.know|
|00004a60| 73 20 6f 66 20 73 6f 6d | 65 20 6f 74 68 65 72 20 |s of som|e other |
|00004a70| 73 69 67 6e 61 6c 73 20 | 62 75 74 20 63 61 6e 6e |signals |but cann|
|00004a80| 6f 74 20 67 65 6e 65 72 | 61 74 65 20 74 68 65 6d |ot gener|ate them|
|00004a90| 2e 20 54 68 65 20 73 75 | 70 70 6f 72 74 20 66 6f |. The su|pport fo|
|00004aa0| 72 0a 53 49 47 41 42 52 | 54 20 69 73 20 73 69 6d |r.SIGABR|T is sim|
|00004ab0| 70 6c 65 20 2d 20 62 75 | 74 20 53 49 47 49 4e 54 |ple - bu|t SIGINT|
|00004ac0| 20 69 73 20 61 20 63 6f | 6d 70 6c 65 74 65 6c 79 | is a co|mpletely|
|00004ad0| 20 64 69 66 66 65 72 65 | 6e 74 20 74 68 69 6e 67 | differe|nt thing|
|00004ae0| 3a 0a 0a 59 6f 75 20 63 | 61 6e 6e 6f 74 20 75 73 |:..You c|annot us|
|00004af0| 65 20 65 78 65 63 20 73 | 69 67 6e 61 6c 20 68 61 |e exec s|ignal ha|
|00004b00| 6e 64 6c 65 72 73 20 73 | 69 6e 63 65 20 74 68 65 |ndlers s|ince the|
|00004b10| 79 20 61 72 65 20 63 61 | 6c 6c 65 64 20 61 74 20 |y are ca|lled at |
|00004b20| 61 6e 79 20 74 69 6d 65 | 20 2d 0a 65 76 65 6e 20 |any time| -.even |
|00004b30| 69 6e 20 74 68 65 20 6d | 69 64 64 6c 65 20 6f 66 |in the m|iddle of|
|00004b40| 20 61 20 6c 69 62 72 61 | 72 79 20 63 61 6c 6c 2e | a libra|ry call.|
|00004b50| 20 41 6e 64 20 69 66 20 | 79 6f 75 72 20 6c 69 62 | And if |your lib|
|00004b60| 72 61 72 79 20 6a 75 73 | 74 20 62 6c 6f 63 6b 65 |rary jus|t blocke|
|00004b70| 64 0a 61 20 70 72 69 76 | 61 74 65 20 73 65 6d 61 |d.a priv|ate sema|
|00004b80| 70 68 6f 72 65 20 61 6e | 64 20 79 6f 75 20 6a 75 |phore an|d you ju|
|00004b90| 6d 70 20 6f 75 74 20 6f | 66 20 74 68 65 20 6c 69 |mp out o|f the li|
|00004ba0| 62 72 61 72 79 20 63 6f | 64 65 20 79 6f 75 20 77 |brary co|de you w|
|00004bb0| 69 6c 6c 20 67 65 74 20 | 61 20 6e 69 63 65 0a 64 |ill get |a nice.d|
|00004bc0| 65 61 64 6c 6f 63 6b 20 | 3a 2d 28 2e 20 28 41 6e |eadlock |:-(. (An|
|00004bd0| 64 20 66 6f 72 20 70 65 | 6f 70 6c 65 20 77 68 6f |d for pe|ople who|
|00004be0| 20 64 6f 6e 27 74 20 6b | 6e 6f 77 3a 20 73 69 67 | don't k|now: sig|
|00004bf0| 6e 61 6c 20 68 61 6e 64 | 6c 65 72 73 20 61 72 65 |nal hand|lers are|
|00004c00| 20 62 6f 67 75 73 0a 75 | 70 74 6f 20 4f 53 20 32 | bogus.u|pto OS 2|
|00004c10| 2e 30 20 28 65 76 65 6e | 20 74 68 65 72 65 20 79 |.0 (even| there y|
|00004c20| 6f 75 20 6e 65 65 64 20 | 61 20 67 6f 6f 64 20 73 |ou need |a good s|
|00004c30| 65 74 70 61 74 63 68 29 | 29 2e 0a 0a 53 6f 20 53 |etpatch)|)...So S|
|00004c40| 49 47 49 4e 54 20 28 43 | 54 52 4c 2d 43 29 20 69 |IGINT (C|TRL-C) i|
|00004c50| 73 20 6a 75 73 74 20 70 | 6f 6c 6c 65 64 20 61 74 |s just p|olled at|
|00004c60| 20 74 68 65 20 73 74 61 | 72 74 20 6f 66 20 6d 6f | the sta|rt of mo|
|00004c70| 73 74 20 49 2f 4f 2d 66 | 75 6e 63 74 69 6f 6e 73 |st I/O-f|unctions|
|00004c80| 20 62 79 0a 63 61 6c 6c | 69 6e 67 20 74 68 65 20 | by.call|ing the |
|00004c90| 66 75 6e 63 74 69 6f 6e | 20 0a 0a 40 63 6f 64 65 |function| ..@code|
|00004ca0| 7b 76 6f 69 64 20 5f 5f | 63 68 6b 61 62 6f 72 74 |{void __|chkabort|
|00004cb0| 28 76 6f 69 64 29 7d 0a | 0a 4f 74 68 65 72 20 73 |(void)}.|.Other s|
|00004cc0| 69 67 6e 61 6c 73 20 61 | 72 65 20 65 76 65 6e 20 |ignals a|re even |
|00004cd0| 6d 6f 72 65 20 64 69 66 | 66 69 63 75 6c 74 20 74 |more dif|ficult t|
|00004ce0| 6f 20 69 6d 70 6c 65 6d | 65 6e 74 3a 0a 0a 40 69 |o implem|ent:..@i|
|00004cf0| 74 65 6d 69 7a 65 20 40 | 62 75 6c 6c 65 74 0a 40 |temize @|bullet.@|
|00004d00| 69 74 65 6d 0a 53 49 47 | 53 45 47 56 20 73 69 6d |item.SIG|SEGV sim|
|00004d10| 70 6c 79 20 64 6f 65 73 | 6e 27 74 20 65 78 69 73 |ply does|n't exis|
|00004d20| 74 20 2d 20 61 6e 64 20 | 69 66 20 69 74 20 64 6f |t - and |if it do|
|00004d30| 65 73 20 69 74 27 73 20 | 64 75 65 0a 74 6f 20 61 |es it's |due.to a|
|00004d40| 20 56 4d 20 73 79 73 74 | 65 6d 20 61 6e 64 20 73 | VM syst|em and s|
|00004d50| 68 6f 75 6c 64 20 6e 6f | 74 20 62 65 20 67 65 6e |hould no|t be gen|
|00004d60| 65 72 61 74 65 64 2e 0a | 40 69 74 65 6d 0a 53 49 |erated..|@item.SI|
|00004d70| 47 46 50 45 20 69 73 20 | 6e 6f 74 20 67 65 6e 65 |GFPE is |not gene|
|00004d80| 72 61 74 65 64 20 62 79 | 20 74 68 65 20 6d 61 74 |rated by| the mat|
|00004d90| 68 20 6c 69 62 72 61 72 | 69 65 73 20 2d 20 73 6f |h librar|ies - so|
|00004da0| 20 69 74 20 77 6f 75 6c | 64 0a 62 65 20 61 20 62 | it woul|d.be a b|
|00004db0| 61 64 20 74 68 69 6e 67 | 20 74 6f 20 67 65 6e 65 |ad thing| to gene|
|00004dc0| 72 61 74 65 20 69 74 20 | 62 79 20 74 68 65 20 6d |rate it |by the m|
|00004dd0| 61 74 68 65 6d 61 74 69 | 63 61 6c 20 63 6f 70 72 |athemati|cal copr|
|00004de0| 6f 63 65 73 73 6f 72 2e | 0a 40 69 74 65 6d 0a 53 |ocessor.|.@item.S|
|00004df0| 49 47 49 4c 4c 20 73 68 | 6f 75 6c 64 20 6e 65 76 |IGILL sh|ould nev|
|00004e00| 65 72 20 68 61 70 70 65 | 6e 20 2d 20 79 6f 75 72 |er happe|n - your|
|00004e10| 20 70 72 6f 67 72 61 6d | 20 6d 75 73 74 20 62 65 | program| must be|
|00004e20| 20 66 61 75 6c 74 79 20 | 69 66 20 79 6f 75 20 67 | faulty |if you g|
|00004e30| 65 74 20 6f 6e 65 2e 0a | 4d 6f 73 74 20 6f 66 20 |et one..|Most of |
|00004e40| 74 68 65 20 74 69 6d 65 | 20 74 68 69 73 20 68 61 |the time| this ha|
|00004e50| 70 70 65 6e 73 20 69 66 | 20 79 6f 75 20 74 72 79 |ppens if| you try|
|00004e60| 20 74 6f 20 72 75 6e 20 | 61 20 36 38 30 32 30 2b | to run |a 68020+|
|00004e70| 20 63 6f 6d 70 69 6c 65 | 64 20 70 72 6f 67 72 61 | compile|d progra|
|00004e80| 6d 0a 6f 6e 20 61 20 70 | 6c 61 69 6e 20 36 38 30 |m.on a p|lain 680|
|00004e90| 30 30 2e 0a 40 69 74 65 | 6d 0a 53 49 47 54 45 52 |00..@ite|m.SIGTER|
|00004ea0| 4d 20 63 6f 75 6c 64 6e | 27 74 20 62 65 20 64 69 |M couldn|'t be di|
|00004eb0| 73 61 62 6c 65 64 20 2d | 20 65 76 65 6e 20 69 66 |sabled -| even if|
|00004ec0| 20 69 74 20 77 61 73 20 | 74 68 65 72 65 20 3b 2d | it was |there ;-|
|00004ed0| 29 2e 0a 40 65 6e 64 20 | 69 74 65 6d 69 7a 65 0a |)..@end |itemize.|
|00004ee0| 0a 59 6f 75 20 63 61 6e | 20 64 69 73 61 62 6c 65 |.You can| disable|
|00004ef0| 20 43 54 52 4c 2d 43 20 | 68 61 6e 64 6c 69 6e 67 | CTRL-C |handling|
|00004f00| 20 62 79 20 72 65 70 6c | 61 63 69 6e 67 20 40 73 | by repl|acing @s|
|00004f10| 61 6d 70 7b 5f 5f 63 68 | 6b 61 62 6f 72 74 7d 20 |amp{__ch|kabort} |
|00004f20| 77 69 74 68 20 61 20 64 | 6f 2d 6e 6f 74 68 69 6e |with a d|o-nothin|
|00004f30| 67 20 0a 73 74 75 62 20 | 66 75 6e 63 74 69 6f 6e |g .stub |function|
|00004f40| 20 2d 20 62 75 74 20 74 | 68 65 72 65 20 69 73 20 | - but t|here is |
|00004f50| 61 20 62 65 74 74 65 72 | 20 77 61 79 2e 20 4a 75 |a better| way. Ju|
|00004f60| 73 74 20 63 61 6c 6c 0a | 0a 40 63 6f 64 65 7b 73 |st call.|.@code{s|
|00004f70| 69 67 6e 61 6c 28 53 49 | 47 49 4e 54 2c 53 49 47 |ignal(SI|GINT,SIG|
|00004f80| 5f 49 47 4e 29 7d 0a 0a | 52 65 70 6c 61 63 69 6e |_IGN)}..|Replacin|
|00004f90| 67 20 5f 5f 63 68 6b 61 | 62 6f 72 74 20 69 73 20 |g __chka|bort is |
|00004fa0| 75 73 65 64 20 76 65 72 | 79 20 6f 66 74 65 6e 20 |used ver|y often |
|00004fb0| 62 79 20 61 6d 69 67 61 | 2d 70 72 6f 67 72 61 6d |by amiga|-program|
|00004fc0| 73 20 61 6e 64 20 69 66 | 0a 79 6f 75 72 20 61 70 |s and if|.your ap|
|00004fd0| 70 6c 69 63 61 74 69 6f | 6e 20 64 6f 65 73 20 6e |plicatio|n does n|
|00004fe0| 6f 74 20 6e 65 65 64 20 | 43 54 52 4c 2d 43 20 68 |ot need |CTRL-C h|
|00004ff0| 61 6e 64 6c 69 6e 67 20 | 61 74 20 61 6c 6c 20 61 |andling |at all a|
|00005000| 6e 64 20 69 73 0a 61 6d | 69 67 61 20 73 70 65 63 |nd is.am|iga spec|
|00005010| 69 66 69 63 20 79 6f 75 | 20 63 61 6e 20 75 73 65 |ific you| can use|
|00005020| 20 74 68 69 73 2e 20 54 | 68 65 20 73 65 63 6f 6e | this. T|he secon|
|00005030| 64 20 6d 65 74 68 6f 64 | 20 69 73 20 74 68 65 0a |d method| is the.|
|00005040| 41 4e 53 49 20 73 74 61 | 6e 64 61 72 64 20 6d 65 |ANSI sta|ndard me|
|00005050| 74 68 6f 64 20 61 6e 64 | 20 77 6f 72 6b 73 20 6f |thod and| works o|
|00005060| 6e 20 61 6c 6c 20 74 79 | 70 65 73 20 6f 66 20 6d |n all ty|pes of m|
|00005070| 61 63 68 69 6e 65 73 2e | 0a 0a 40 6e 6f 64 65 20 |achines.|..@node |
|00005080| 73 65 74 6a 6d 70 20 6c | 6f 6e 67 6a 6d 70 2c 63 |setjmp l|ongjmp,c|
|00005090| 74 79 70 65 2c 53 69 67 | 6e 61 6c 20 68 61 6e 64 |type,Sig|nal hand|
|000050a0| 6c 69 6e 67 2c 6c 69 62 | 6e 69 78 2e 61 0a 40 63 |ling,lib|nix.a.@c|
|000050b0| 68 61 70 74 65 72 20 73 | 65 74 6a 6d 70 2c 20 6c |hapter s|etjmp, l|
|000050c0| 6f 6e 67 6a 6d 70 0a 0a | 54 68 69 73 20 6c 69 62 |ongjmp..|This lib|
|000050d0| 72 61 72 79 20 69 73 20 | 63 6f 6d 70 61 74 69 62 |rary is |compatib|
|000050e0| 6c 65 20 74 6f 20 74 68 | 65 20 68 65 61 64 65 72 |le to th|e header|
|000050f0| 20 66 69 6c 65 73 20 74 | 68 61 74 20 63 6f 6d 65 | files t|hat come|
|00005100| 20 77 69 74 68 20 67 63 | 63 20 2d 0a 61 6e 64 20 | with gc|c -.and |
|00005110| 74 68 65 20 6a 6d 70 5f | 62 75 66 20 69 6e 20 74 |the jmp_|buf in t|
|00005120| 68 65 72 65 20 69 73 20 | 6e 6f 74 20 6c 61 72 67 |here is |not larg|
|00005130| 65 20 65 6e 6f 75 67 68 | 20 66 6f 72 20 74 68 65 |e enough| for the|
|00005140| 20 46 50 55 20 72 65 67 | 69 73 74 65 72 73 2e 0a | FPU reg|isters..|
|00005150| 53 6f 20 74 68 65 79 20 | 61 72 65 20 6e 6f 74 20 |So they |are not |
|00005160| 72 65 73 74 6f 72 65 64 | 21 20 54 68 65 20 41 4e |restored|! The AN|
|00005170| 53 49 20 73 74 61 6e 64 | 61 72 64 20 64 6f 65 73 |SI stand|ard does|
|00005180| 6e 27 74 20 65 76 65 6e | 20 72 65 71 75 69 72 65 |n't even| require|
|00005190| 20 74 6f 0a 72 65 73 74 | 6f 72 65 20 61 6e 79 20 | to.rest|ore any |
|000051a0| 6f 66 20 74 68 65 20 6f | 74 68 65 72 20 6c 6f 63 |of the o|ther loc|
|000051b0| 61 6c 20 76 61 72 69 61 | 62 6c 65 73 20 28 74 68 |al varia|bles (th|
|000051c0| 65 79 20 61 72 65 20 72 | 65 73 74 6f 72 65 64 20 |ey are r|estored |
|000051d0| 3a 2d 29 20 29 2c 0a 73 | 6f 20 74 68 69 73 20 69 |:-) ),.s|o this i|
|000051e0| 73 20 4e 4f 20 69 6e 63 | 6f 6d 70 61 74 69 62 69 |s NO inc|ompatibi|
|000051f0| 6c 69 74 79 20 74 6f 20 | 74 68 65 20 41 4e 53 49 |lity to |the ANSI|
|00005200| 20 73 74 61 6e 64 61 72 | 64 2e 0a 0a 40 6e 6f 64 | standar|d...@nod|
|00005210| 65 20 63 74 79 70 65 2c | 63 6c 6f 63 6b 2c 73 65 |e ctype,|clock,se|
|00005220| 74 6a 6d 70 20 6c 6f 6e | 67 6a 6d 70 2c 6c 69 62 |tjmp lon|gjmp,lib|
|00005230| 6e 69 78 2e 61 0a 40 63 | 68 61 70 74 65 72 20 63 |nix.a.@c|hapter c|
|00005240| 74 79 70 65 2e 68 20 66 | 75 6e 63 74 69 6f 6e 73 |type.h f|unctions|
|00005250| 0a 0a 49 66 20 79 6f 75 | 20 6c 6f 6f 6b 20 69 6e |..If you| look in|
|00005260| 74 6f 20 63 74 79 70 65 | 2e 68 20 79 6f 75 20 77 |to ctype|.h you w|
|00005270| 69 6c 6c 20 73 65 65 20 | 74 68 61 74 20 74 68 65 |ill see |that the|
|00005280| 20 66 75 6e 63 74 69 6f | 6e 73 20 69 6e 20 74 68 | functio|ns in th|
|00005290| 65 72 65 20 61 72 65 0a | 6a 75 73 74 20 6d 61 63 |ere are.|just mac|
|000052a0| 72 6f 73 20 2d 20 61 6e | 64 20 74 68 61 74 20 74 |ros - an|d that t|
|000052b0| 68 65 79 20 61 72 65 20 | 64 75 70 6c 69 63 61 74 |hey are |duplicat|
|000052c0| 65 20 69 6e 20 74 68 65 | 20 6c 69 62 72 61 72 79 |e in the| library|
|000052d0| 20 61 73 20 66 75 6e 63 | 74 69 6f 6e 73 2e 0a 54 | as func|tions..T|
|000052e0| 68 69 73 20 69 73 20 4e | 4f 54 20 61 20 6d 69 73 |his is N|OT a mis|
|000052f0| 74 61 6b 65 2e 20 54 68 | 65 20 41 4e 53 49 20 73 |take. Th|e ANSI s|
|00005300| 74 61 6e 64 61 72 64 20 | 72 65 71 75 69 72 65 73 |tandard |requires|
|00005310| 20 73 75 63 68 20 6d 61 | 63 72 6f 73 20 74 6f 20 | such ma|cros to |
|00005320| 62 65 0a 64 75 70 6c 69 | 63 61 74 65 20 61 73 20 |be.dupli|cate as |
|00005330| 66 75 6e 63 74 69 6f 6e | 73 2e 0a 0a 41 6e 64 20 |function|s...And |
|00005340| 72 65 6d 65 6d 62 65 72 | 3a 20 54 68 65 73 65 20 |remember|: These |
|00005350| 66 75 6e 63 74 69 6f 6e | 73 20 61 72 65 20 61 66 |function|s are af|
|00005360| 66 65 63 74 65 64 20 62 | 79 20 74 68 65 20 73 65 |fected b|y the se|
|00005370| 74 6c 6f 63 61 6c 65 28 | 29 20 63 61 6c 6c 2e 0a |tlocale(|) call..|
|00005380| 0a 40 6e 6f 64 65 20 63 | 6c 6f 63 6b 2c 4d 75 6c |.@node c|lock,Mul|
|00005390| 74 69 62 79 74 65 20 63 | 68 61 72 61 63 74 65 72 |tibyte c|haracter|
|000053a0| 20 66 75 6e 63 74 69 6f | 6e 73 2c 63 74 79 70 65 | functio|ns,ctype|
|000053b0| 2c 6c 69 62 6e 69 78 2e | 61 0a 40 63 68 61 70 74 |,libnix.|a.@chapt|
|000053c0| 65 72 20 54 68 65 20 63 | 6c 6f 63 6b 20 66 75 6e |er The c|lock fun|
|000053d0| 63 74 69 6f 6e 0a 0a 54 | 68 65 20 63 6c 6f 63 6b |ction..T|he clock|
|000053e0| 28 29 20 66 75 6e 63 74 | 69 6f 6e 27 73 20 77 6f |() funct|ion's wo|
|000053f0| 72 6b 20 69 73 20 74 6f | 20 6d 65 61 73 75 72 65 |rk is to| measure|
|00005400| 20 70 72 6f 63 65 73 73 | 6f 72 20 74 69 6d 65 20 | process|or time |
|00005410| 66 6f 72 20 74 68 65 20 | 73 70 65 63 69 66 69 63 |for the |specific|
|00005420| 0a 74 61 73 6b 20 2d 20 | 62 75 74 20 74 68 65 72 |.task - |but ther|
|00005430| 65 20 69 73 20 6e 6f 20 | 69 6e 66 6f 72 6d 61 74 |e is no |informat|
|00005440| 69 6f 6e 20 6c 69 6b 65 | 20 74 68 69 73 20 69 6e |ion like| this in|
|00005450| 20 74 68 65 20 61 6d 69 | 67 61 20 4f 53 20 3a 2d | the ami|ga OS :-|
|00005460| 28 2e 0a 53 6f 20 69 74 | 20 6a 75 73 74 20 6d 65 |(..So it| just me|
|00005470| 61 73 75 72 65 73 20 74 | 68 65 20 74 69 6d 65 20 |asures t|he time |
|00005480| 66 72 6f 6d 20 70 72 6f | 67 72 61 6d 20 73 74 61 |from pro|gram sta|
|00005490| 72 74 20 6f 6e 20 2d 20 | 61 6e 64 20 69 73 20 63 |rt on - |and is c|
|000054a0| 6f 6d 70 61 74 69 62 6c | 65 20 77 69 74 68 0a 74 |ompatibl|e with.t|
|000054b0| 68 69 73 20 62 65 68 61 | 76 69 6f 75 72 20 74 6f |his beha|viour to|
|000054c0| 20 61 6c 6c 20 73 69 6e | 67 6c 65 20 74 61 73 6b | all sin|gle task|
|000054d0| 69 6e 67 20 4f 53 73 20 | 61 72 6f 75 6e 64 2e 0a |ing OSs |around..|
|000054e0| 0a 40 6e 6f 64 65 20 4d | 75 6c 74 69 62 79 74 65 |.@node M|ultibyte|
|000054f0| 20 63 68 61 72 61 63 74 | 65 72 20 66 75 6e 63 74 | charact|er funct|
|00005500| 69 6f 6e 73 2c 2c 63 6c | 6f 63 6b 2c 6c 69 62 6e |ions,,cl|ock,libn|
|00005510| 69 78 2e 61 0a 40 63 68 | 61 70 74 65 72 20 4d 75 |ix.a.@ch|apter Mu|
|00005520| 6c 74 69 62 79 74 65 20 | 63 68 61 72 61 63 74 65 |ltibyte |characte|
|00005530| 72 20 66 75 6e 63 74 69 | 6f 6e 73 0a 0a 54 68 65 |r functi|ons..The|
|00005540| 20 6d 75 6c 74 69 62 79 | 74 65 20 63 68 61 72 61 | multiby|te chara|
|00005550| 63 74 65 72 20 66 75 6e | 63 74 69 6f 6e 73 20 61 |cter fun|ctions a|
|00005560| 72 65 20 61 6c 6c 20 74 | 68 65 72 65 20 2d 20 62 |re all t|here - b|
|00005570| 75 74 20 73 69 6e 63 65 | 20 74 68 65 0a 41 6d 69 |ut since| the.Ami|
|00005580| 67 61 20 4f 53 20 75 73 | 65 73 20 6e 6f 20 6f 74 |ga OS us|es no ot|
|00005590| 68 65 72 20 63 68 61 72 | 61 63 74 65 72 20 73 65 |her char|acter se|
|000055a0| 74 20 74 68 61 6e 20 45 | 43 4d 41 20 4c 61 74 69 |t than E|CMA Lati|
|000055b0| 6e 20 49 20 74 68 65 79 | 20 73 69 6d 75 6c 61 74 |n I they| simulat|
|000055c0| 65 0a 6a 75 73 74 20 22 | 43 22 20 6c 6f 63 61 6c |e.just "|C" local|
|000055d0| 65 2e 20 54 68 69 73 20 | 6d 65 61 6e 73 20 74 68 |e. This |means th|
|000055e0| 65 79 20 64 6f 20 6e 6f | 74 68 69 6e 67 20 75 73 |ey do no|thing us|
|000055f0| 65 66 75 6c 2e 0a 0a 40 | 6e 6f 64 65 20 6c 69 62 |eful...@|node lib|
|00005600| 73 74 75 62 73 2e 61 2c | 64 65 74 61 63 68 2e 6f |stubs.a,|detach.o|
|00005610| 2c 6c 69 62 61 6d 69 67 | 61 2e 61 2c 46 65 61 74 |,libamig|a.a,Feat|
|00005620| 75 72 65 73 0a 40 63 68 | 61 70 74 65 72 20 6c 69 |ures.@ch|apter li|
|00005630| 62 73 74 75 62 73 20 2d | 20 61 75 74 6f 6d 61 74 |bstubs -| automat|
|00005640| 69 63 20 6c 69 62 72 61 | 72 79 20 6f 70 65 6e 69 |ic libra|ry openi|
|00005650| 6e 67 0a 0a 54 68 65 20 | 41 6d 69 67 61 20 4f 53 |ng..The |Amiga OS|
|00005660| 20 73 68 61 72 65 64 20 | 6c 69 62 72 61 72 69 65 | shared |librarie|
|00005670| 73 20 61 72 65 20 61 20 | 6e 69 63 65 20 74 68 69 |s are a |nice thi|
|00005680| 6e 67 2e 20 41 6c 6c 20 | 74 68 65 20 74 61 73 6b |ng. All |the task|
|00005690| 73 20 63 61 6e 0a 75 73 | 65 20 74 68 65 6d 20 69 |s can.us|e them i|
|000056a0| 6e 20 70 61 72 61 6c 6c | 65 6c 2c 20 74 68 65 79 |n parall|el, they|
|000056b0| 20 65 61 74 20 75 70 20 | 6d 65 6d 6f 72 79 20 6f | eat up |memory o|
|000056c0| 6e 6c 79 20 69 66 20 79 | 6f 75 20 75 73 65 20 74 |nly if y|ou use t|
|000056d0| 68 65 6d 20 61 6e 64 0a | 74 68 65 79 20 61 72 65 |hem and.|they are|
|000056e0| 20 73 69 6d 70 6c 65 20 | 74 6f 20 75 73 65 20 2d | simple |to use -|
|000056f0| 20 61 6e 64 20 61 6c 6c | 20 74 68 69 73 20 77 6f | and all| this wo|
|00005700| 72 6b 73 20 65 76 65 6e | 20 77 69 74 68 6f 75 74 |rks even| without|
|00005710| 20 61 0a 6d 65 6d 6f 72 | 79 20 6d 61 6e 61 67 65 | a.memor|y manage|
|00005720| 6d 65 6e 74 20 75 6e 69 | 74 20 28 4d 4d 55 29 2e |ment uni|t (MMU).|
|00005730| 0a 0a 41 6e 6f 74 68 65 | 72 20 6e 69 63 65 20 66 |..Anothe|r nice f|
|00005740| 65 61 74 75 72 65 20 69 | 73 20 74 68 65 20 66 61 |eature i|s the fa|
|00005750| 63 74 20 74 68 61 74 20 | 79 6f 75 20 63 61 6e 20 |ct that |you can |
|00005760| 6f 70 65 6e 20 74 68 65 | 6d 20 75 6e 64 65 72 0a |open the|m under.|
|00005770| 70 72 6f 67 72 61 6d 20 | 63 6f 6e 74 72 6f 6c 2c |program |control,|
|00005780| 20 69 2e 65 2e 20 79 6f | 75 20 63 61 6e 20 74 61 | i.e. yo|u can ta|
|00005790| 6b 65 20 73 6f 6d 65 20 | 61 63 74 69 6f 6e 20 69 |ke some |action i|
|000057a0| 66 20 74 68 65 79 20 64 | 6f 20 6e 6f 74 0a 65 78 |f they d|o not.ex|
|000057b0| 69 73 74 20 2d 20 77 61 | 72 6e 20 74 68 65 20 75 |ist - wa|rn the u|
|000057c0| 73 65 72 2c 20 64 69 73 | 61 62 6c 65 20 73 6f 6d |ser, dis|able som|
|000057d0| 65 20 66 65 61 74 75 72 | 65 73 2c 20 65 74 63 2e |e featur|es, etc.|
|000057e0| 20 54 68 69 73 20 6e 69 | 63 65 20 0a 66 65 61 74 | This ni|ce .feat|
|000057f0| 75 72 65 20 62 65 63 6f | 6d 65 73 20 61 20 6d 69 |ure beco|mes a mi|
|00005800| 73 66 65 61 74 75 72 65 | 20 69 66 20 79 6f 75 20 |sfeature| if you |
|00005810| 6f 6e 6c 79 20 6e 65 65 | 64 20 61 20 63 65 72 74 |only nee|d a cert|
|00005820| 61 69 6e 20 6c 69 73 74 | 0a 6f 66 20 66 75 6e 63 |ain list|.of func|
|00005830| 74 69 6f 6e 73 20 74 68 | 61 74 20 61 72 65 20 74 |tions th|at are t|
|00005840| 68 65 72 65 20 61 6c 6c | 20 74 68 65 20 74 69 6d |here all| the tim|
|00005850| 65 20 2d 20 65 78 65 63 | 2c 20 64 6f 73 2c 20 69 |e - exec|, dos, i|
|00005860| 6e 74 75 69 74 69 6f 6e | 20 2d 0a 79 6f 75 20 73 |ntuition| -.you s|
|00005870| 74 69 6c 6c 20 68 61 76 | 65 20 74 6f 20 6f 70 65 |till hav|e to ope|
|00005880| 6e 20 74 68 65 20 73 68 | 61 72 65 64 20 6c 69 62 |n the sh|ared lib|
|00005890| 72 61 72 69 65 73 2e 0a | 0a 53 6f 20 6d 6f 73 74 |raries..|.So most|
|000058a0| 20 41 6d 69 67 61 20 63 | 6f 6d 70 69 6c 65 72 73 | Amiga c|ompilers|
|000058b0| 20 68 61 76 65 20 61 20 | 66 65 61 74 75 72 65 20 | have a |feature |
|000058c0| 63 61 6c 6c 65 64 20 61 | 75 74 6f 6d 61 74 69 63 |called a|utomatic|
|000058d0| 20 6c 69 62 72 61 72 79 | 0a 6f 70 65 6e 69 6e 67 | library|.opening|
|000058e0| 20 66 65 61 74 75 72 65 | 2e 20 54 68 69 73 20 6d | feature|. This m|
|000058f0| 65 61 6e 73 20 74 68 61 | 74 20 61 6c 6c 20 6c 69 |eans tha|t all li|
|00005900| 62 72 61 72 69 65 73 20 | 79 6f 75 20 72 65 66 65 |braries |you refe|
|00005910| 72 65 6e 63 65 0a 28 62 | 79 20 63 61 6c 6c 69 6e |rence.(b|y callin|
|00005920| 67 20 6f 6e 65 20 6f 66 | 20 74 68 65 20 66 75 6e |g one of| the fun|
|00005930| 63 74 69 6f 6e 73 29 20 | 62 75 74 20 64 6f 6e 27 |ctions) |but don'|
|00005940| 74 20 6f 70 65 6e 20 79 | 6f 75 72 73 65 6c 66 20 |t open y|ourself |
|00005950| 67 65 74 0a 6f 70 65 6e | 65 64 20 66 6f 72 20 79 |get.open|ed for y|
|00005960| 6f 75 20 62 79 20 74 68 | 65 20 63 6f 6d 70 69 6c |ou by th|e compil|
|00005970| 65 72 2e 0a 0a 40 6d 65 | 6e 75 0a 2a 20 41 75 74 |er...@me|nu.* Aut|
|00005980| 6f 2d 6c 69 62 72 61 72 | 79 2d 6f 70 65 6e 69 6e |o-librar|y-openin|
|00005990| 67 20 75 73 61 67 65 3a | 3a 20 20 20 20 20 48 6f |g usage:|: Ho|
|000059a0| 77 20 74 6f 20 75 73 65 | 20 69 74 2e 0a 2a 20 41 |w to use| it..* A|
|000059b0| 75 74 6f 2d 6c 69 62 72 | 61 72 79 2d 6f 70 65 6e |uto-libr|ary-open|
|000059c0| 69 6e 67 20 69 6e 74 65 | 72 66 61 63 65 3a 3a 20 |ing inte|rface:: |
|000059d0| 48 6f 77 20 69 74 20 77 | 6f 72 6b 73 2e 0a 40 65 |How it w|orks..@e|
|000059e0| 6e 64 20 6d 65 6e 75 0a | 0a 40 6e 6f 64 65 20 41 |nd menu.|.@node A|
|000059f0| 75 74 6f 2d 6c 69 62 72 | 61 72 79 2d 6f 70 65 6e |uto-libr|ary-open|
|00005a00| 69 6e 67 20 75 73 61 67 | 65 2c 41 75 74 6f 2d 6c |ing usag|e,Auto-l|
|00005a10| 69 62 72 61 72 79 2d 6f | 70 65 6e 69 6e 67 20 69 |ibrary-o|pening i|
|00005a20| 6e 74 65 72 66 61 63 65 | 2c 6c 69 62 73 74 75 62 |nterface|,libstub|
|00005a30| 73 2e 61 2c 6c 69 62 73 | 74 75 62 73 2e 61 0a 40 |s.a,libs|tubs.a.@|
|00005a40| 63 68 61 70 74 65 72 20 | 55 73 61 67 65 0a 0a 54 |chapter |Usage..T|
|00005a50| 6f 20 75 73 65 20 74 68 | 69 73 20 66 65 61 74 75 |o use th|is featu|
|00005a60| 72 65 20 79 6f 75 20 68 | 61 76 65 20 74 6f 20 64 |re you h|ave to d|
|00005a70| 6f 20 6e 6f 74 68 69 6e | 67 20 28 74 68 65 72 65 |o nothin|g (there|
|00005a80| 66 6f 72 65 20 69 74 27 | 73 20 63 61 6c 6c 65 64 |fore it'|s called|
|00005a90| 0a 61 75 74 6f 6d 61 74 | 69 63 29 2e 20 42 75 74 |.automat|ic). But|
|00005aa0| 20 79 6f 75 20 63 61 6e | 20 63 6f 6e 74 72 6f 6c | you can| control|
|00005ab0| 20 74 68 65 20 6c 69 62 | 72 61 72 79 20 76 65 72 | the lib|rary ver|
|00005ac0| 73 69 6f 6e 20 69 66 20 | 79 6f 75 20 77 69 73 68 |sion if |you wish|
|00005ad0| 0a 62 79 20 64 65 63 6c | 61 72 69 6e 67 0a 0a 40 |.by decl|aring..@|
|00005ae0| 63 6f 64 65 7b 6c 6f 6e | 67 20 5f 5f 6f 73 6c 69 |code{lon|g __osli|
|00005af0| 62 76 65 72 73 69 6f 6e | 3b 7d 0a 0a 73 6f 6d 65 |bversion|;}..some|
|00005b00| 77 68 65 72 65 20 69 6e | 20 79 6f 75 72 20 70 72 |where in| your pr|
|00005b10| 6f 67 72 61 6d 2e 20 42 | 75 74 20 64 6f 6e 27 74 |ogram. B|ut don't|
|00005b20| 20 73 65 74 20 74 68 69 | 73 20 6c 6f 77 65 72 20 | set thi|s lower |
|00005b30| 74 68 61 6e 20 33 37 20 | 2d 20 6d 6f 73 74 20 66 |than 37 |- most f|
|00005b40| 75 6e 63 74 69 6f 6e 73 | 0a 6f 66 20 6c 69 62 6e |unctions|.of libn|
|00005b50| 69 78 20 28 69 6e 63 6c | 75 64 69 6e 67 20 74 68 |ix (incl|uding th|
|00005b60| 65 20 63 6f 6d 6d 61 6e | 64 6c 69 6e 65 20 70 61 |e comman|dline pa|
|00005b70| 72 73 65 72 73 29 20 6e | 65 65 64 20 33 37 20 6f |rsers) n|eed 37 o|
|00005b80| 72 20 6d 6f 72 65 2e 0a | 0a 40 6e 6f 64 65 20 41 |r more..|.@node A|
|00005b90| 75 74 6f 2d 6c 69 62 72 | 61 72 79 2d 6f 70 65 6e |uto-libr|ary-open|
|00005ba0| 69 6e 67 20 69 6e 74 65 | 72 66 61 63 65 2c 2c 41 |ing inte|rface,,A|
|00005bb0| 75 74 6f 2d 6c 69 62 72 | 61 72 79 2d 6f 70 65 6e |uto-libr|ary-open|
|00005bc0| 69 6e 67 20 75 73 61 67 | 65 2c 6c 69 62 73 74 75 |ing usag|e,libstu|
|00005bd0| 62 73 2e 61 0a 40 63 68 | 61 70 74 65 72 20 49 6e |bs.a.@ch|apter In|
|00005be0| 74 65 72 66 61 63 65 0a | 0a 49 6d 70 6c 65 6d 65 |terface.|.Impleme|
|00005bf0| 6e 74 69 6e 67 20 73 75 | 63 68 20 61 20 66 65 61 |nting su|ch a fea|
|00005c00| 74 75 72 65 20 69 73 20 | 6e 6f 20 68 61 72 64 20 |ture is |no hard |
|00005c10| 77 6f 72 6b 20 69 66 20 | 79 6f 75 20 6b 6e 6f 77 |work if |you know|
|00005c20| 20 68 6f 77 20 2d 20 74 | 68 69 73 0a 69 6d 70 6c | how - t|his.impl|
|00005c30| 65 6d 65 6e 74 61 74 69 | 6f 6e 20 75 73 65 73 20 |ementati|on uses |
|00005c40| 61 20 28 6e 6f 74 20 73 | 6f 20 67 6f 6f 64 20 6b |a (not s|o good k|
|00005c50| 6e 6f 77 6e 29 20 66 65 | 61 74 75 72 65 20 6f 66 |nown) fe|ature of|
|00005c60| 20 74 68 65 20 67 6e 75 | 20 6c 69 6e 6b 65 72 0a | the gnu| linker.|
|00005c70| 63 61 6c 6c 65 64 20 73 | 65 74 20 65 6c 65 6d 65 |called s|et eleme|
|00005c80| 6e 74 73 3a 0a 0a 40 65 | 6e 75 6d 65 72 61 74 65 |nts:..@e|numerate|
|00005c90| 0a 40 69 74 65 6d 0a 59 | 6f 75 20 77 72 69 74 65 |.@item.Y|ou write|
|00005ca0| 20 61 20 6c 69 62 72 61 | 72 79 20 65 6e 74 72 79 | a libra|ry entry|
|00005cb0| 20 66 6f 72 20 65 76 65 | 72 79 20 6c 69 62 72 61 | for eve|ry libra|
|00005cc0| 72 79 20 62 61 73 65 20 | 61 6e 64 20 6c 69 6e 6b |ry base |and link|
|00005cd0| 20 74 68 69 73 20 6c 69 | 62 72 61 72 79 20 61 73 | this li|brary as|
|00005ce0| 20 74 68 65 0a 6c 61 73 | 74 20 6f 6e 65 2e 20 54 | the.las|t one. T|
|00005cf0| 68 69 73 20 6d 65 61 6e | 73 20 74 68 61 74 20 74 |his mean|s that t|
|00005d00| 68 65 20 6c 69 6e 6b 65 | 72 20 75 73 65 73 20 74 |he linke|r uses t|
|00005d10| 68 69 73 20 6c 69 62 72 | 61 72 79 20 66 6f 72 20 |his libr|ary for |
|00005d20| 65 76 65 72 79 20 6c 69 | 62 72 61 72 79 20 62 61 |every li|brary ba|
|00005d30| 73 65 0a 70 6f 69 6e 74 | 65 72 20 74 68 61 74 20 |se.point|er that |
|00005d40| 69 73 20 6e 6f 74 20 64 | 65 66 69 6e 65 64 20 62 |is not d|efined b|
|00005d50| 75 74 20 72 65 66 65 72 | 65 6e 63 65 64 20 73 6f |ut refer|enced so|
|00005d60| 6d 65 77 68 65 72 65 2e | 0a 40 69 74 65 6d 0a 59 |mewhere.|.@item.Y|
|00005d70| 6f 75 20 74 65 6c 6c 20 | 74 68 65 20 6c 69 6e 6b |ou tell |the link|
|00005d80| 65 72 20 74 6f 20 63 6f | 6c 6c 65 63 74 20 74 68 |er to co|llect th|
|00005d90| 65 73 65 20 6c 69 62 72 | 61 72 79 20 62 61 73 65 |ese libr|ary base|
|00005da0| 73 20 74 6f 67 65 74 68 | 65 72 20 69 6e 74 6f 20 |s togeth|er into |
|00005db0| 61 20 73 65 74 20 65 6c | 65 6d 65 6e 74 2e 0a 40 |a set el|ement..@|
|00005dc0| 69 74 65 6d 0a 59 6f 75 | 20 77 72 69 74 65 20 61 |item.You| write a|
|00005dd0| 20 66 75 6e 63 74 69 6f | 6e 20 74 68 61 74 20 6f | functio|n that o|
|00005de0| 70 65 6e 73 20 61 6c 6c | 20 6c 69 62 72 61 72 69 |pens all| librari|
|00005df0| 65 73 20 69 6e 20 74 68 | 65 20 73 65 74 20 65 6c |es in th|e set el|
|00005e00| 65 6d 65 6e 74 20 61 74 | 0a 70 72 6f 67 72 61 6d |ement at|.program|
|00005e10| 20 73 74 61 72 74 20 61 | 6e 64 20 63 6c 65 61 6e | start a|nd clean|
|00005e20| 73 20 74 68 65 6d 20 75 | 70 20 6c 61 74 65 72 2e |s them u|p later.|
|00005e30| 0a 40 65 6e 64 20 65 6e | 75 6d 65 72 61 74 65 0a |.@end en|umerate.|
|00005e40| 0a 53 6f 6d 65 20 64 65 | 74 61 69 6c 73 3a 0a 0a |.Some de|tails:..|
|00005e50| 54 68 65 72 65 20 61 72 | 65 20 74 77 6f 20 6f 62 |There ar|e two ob|
|00005e60| 6a 65 63 74 20 66 69 6c | 65 73 20 69 6e 20 74 68 |ject fil|es in th|
|00005e70| 65 20 6c 69 62 72 61 72 | 79 20 66 6f 72 20 65 76 |e librar|y for ev|
|00005e80| 65 72 79 20 6c 69 62 72 | 61 72 79 20 62 61 73 65 |ery libr|ary base|
|00005e90| 20 70 6f 69 6e 74 65 72 | 2e 0a 54 68 65 20 66 69 | pointer|..The fi|
|00005ea0| 72 73 74 20 6f 6e 65 20 | 69 73 20 61 0a 0a 40 65 |rst one |is a..@e|
|00005eb0| 78 61 6d 70 6c 65 0a 73 | 74 72 75 63 74 20 6c 69 |xample.s|truct li|
|00005ec0| 62 0a 40 7b 20 73 74 72 | 75 63 74 20 4c 69 62 72 |b.@{ str|uct Libr|
|00005ed0| 61 72 79 20 2a 62 61 73 | 65 3b 0a 20 20 63 68 61 |ary *bas|e;. cha|
|00005ee0| 72 20 2a 6e 61 6d 65 3b | 20 40 7d 3b 0a 40 65 6e |r *name;| @};.@en|
|00005ef0| 64 20 65 78 61 6d 70 6c | 65 0a 0a 63 6f 6e 74 61 |d exampl|e..conta|
|00005f00| 69 6e 69 6e 67 20 74 68 | 65 20 6c 69 62 72 61 72 |ining th|e librar|
|00005f10| 79 20 62 61 73 65 20 70 | 6f 69 6e 74 65 72 20 28 |y base p|ointer (|
|00005f20| 61 20 40 73 61 6d 70 7b | 4e 55 4c 4c 7d 20 70 6f |a @samp{|NULL} po|
|00005f30| 69 6e 74 65 72 20 61 74 | 20 70 72 6f 67 72 61 6d |inter at| program|
|00005f40| 20 73 74 61 72 74 29 0a | 61 6e 64 20 61 20 70 6f | start).|and a po|
|00005f50| 69 6e 74 65 72 20 74 6f | 20 74 68 65 20 6e 61 6d |inter to| the nam|
|00005f60| 65 20 6f 66 20 74 68 65 | 20 6c 69 62 72 61 72 79 |e of the| library|
|00005f70| 2e 20 54 68 69 73 20 6e | 61 6d 65 0a 0a 40 73 61 |. This n|ame..@sa|
|00005f80| 6d 70 7b 65 78 74 65 72 | 6e 20 63 68 61 72 20 6e |mp{exter|n char n|
|00005f90| 61 6d 65 5b 5d 7d 0a 0a | 69 73 20 74 68 65 20 73 |ame[]}..|is the s|
|00005fa0| 65 63 6f 6e 64 20 6f 62 | 6a 65 63 74 2e 20 41 6c |econd ob|ject. Al|
|00005fb0| 6c 20 74 68 65 73 65 20 | 73 74 72 75 63 74 73 20 |l these |structs |
|00005fc0| 61 72 65 20 63 6f 6c 6c | 65 63 74 65 64 20 74 6f |are coll|ected to|
|00005fd0| 67 65 74 68 65 72 20 69 | 6e 74 6f 20 6f 6e 65 0a |gether i|nto one.|
|00005fe0| 73 69 6e 67 6c 65 20 73 | 65 74 20 65 6c 65 6d 65 |single s|et eleme|
|00005ff0| 6e 74 20 63 61 6c 6c 65 | 64 0a 0a 40 73 61 6d 70 |nt calle|d..@samp|
|00006000| 7b 65 78 74 65 72 6e 20 | 73 74 72 75 63 74 20 6c |{extern |struct l|
|00006010| 69 62 20 2a 5f 5f 4c 49 | 42 5f 4c 49 53 54 5f 5f |ib *__LI|B_LIST__|
|00006020| 5b 5d 7d 0a 0a 54 6f 20 | 6f 70 65 6e 20 61 6e 64 |[]}..To |open and|
|00006030| 20 63 6c 6f 73 65 20 74 | 68 65 20 73 68 61 72 65 | close t|he share|
|00006040| 64 20 6c 69 62 72 61 72 | 69 65 73 20 74 68 65 72 |d librar|ies ther|
|00006050| 65 20 61 72 65 20 74 77 | 6f 20 66 75 6e 63 74 69 |e are tw|o functi|
|00006060| 6f 6e 73 20 69 6e 0a 6c | 69 62 73 74 75 62 73 3a |ons in.l|ibstubs:|
|00006070| 0a 0a 40 63 6f 64 65 7b | 76 6f 69 64 20 5f 5f 69 |..@code{|void __i|
|00006080| 6e 69 74 6c 69 62 72 61 | 72 69 65 73 28 76 6f 69 |nitlibra|ries(voi|
|00006090| 64 29 7d 0a 0a 61 6e 64 | 0a 0a 40 63 6f 64 65 7b |d)}..and|..@code{|
|000060a0| 76 6f 69 64 20 5f 5f 65 | 78 69 74 6c 69 62 72 61 |void __e|xitlibra|
|000060b0| 72 69 65 73 28 76 6f 69 | 64 29 7d 0a 0a 53 69 6e |ries(voi|d)}..Sin|
|000060c0| 63 65 20 69 74 20 69 73 | 20 73 74 69 6c 6c 20 70 |ce it is| still p|
|000060d0| 6f 73 73 69 62 6c 65 20 | 74 6f 20 6f 70 65 6e 20 |ossible |to open |
|000060e0| 74 68 65 20 73 68 61 72 | 65 64 20 6c 69 62 72 61 |the shar|ed libra|
|000060f0| 72 69 65 73 20 62 79 20 | 68 61 6e 64 20 49 20 68 |ries by |hand I h|
|00006100| 61 64 0a 74 6f 20 74 61 | 6b 65 20 63 61 72 65 20 |ad.to ta|ke care |
|00006110| 61 62 6f 75 74 20 74 68 | 65 20 6c 69 62 72 61 72 |about th|e librar|
|00006120| 79 20 62 61 73 65 20 70 | 6f 69 6e 74 65 72 73 20 |y base p|ointers |
|00006130| 66 6f 72 20 6c 69 62 6e | 69 78 20 69 74 73 65 6c |for libn|ix itsel|
|00006140| 66 20 2d 0a 74 68 65 79 | 20 61 72 65 20 75 73 65 |f -.they| are use|
|00006150| 64 20 69 6e 20 74 68 65 | 20 63 6f 6d 6d 61 6e 64 |d in the| command|
|00006160| 6c 69 6e 65 20 70 61 72 | 73 65 72 73 20 2d 20 65 |line par|sers - e|
|00006170| 76 65 6e 20 62 65 66 6f | 72 65 20 61 6e 79 62 6f |ven befo|re anybo|
|00006180| 64 79 20 63 6f 75 6c 64 | 0a 6f 70 65 6e 20 74 68 |dy could|.open th|
|00006190| 65 6d 2e 20 54 68 65 72 | 65 20 65 78 69 73 74 73 |em. Ther|e exists|
|000061a0| 20 61 20 28 6c 69 62 72 | 61 72 79 20 70 72 69 76 | a (libr|ary priv|
|000061b0| 61 74 65 29 20 64 75 70 | 6c 69 63 61 74 65 20 6c |ate) dup|licate l|
|000061c0| 69 62 72 61 72 79 20 62 | 61 73 65 0a 70 6f 69 6e |ibrary b|ase.poin|
|000061d0| 74 65 72 20 66 6f 72 20 | 65 61 63 68 20 6f 66 20 |ter for |each of |
|000061e0| 74 68 65 73 65 2e 20 54 | 68 65 79 20 68 61 76 65 |these. T|hey have|
|000061f0| 20 6e 6f 72 6d 61 6c 20 | 6e 61 6d 65 73 20 77 69 | normal |names wi|
|00006200| 74 68 0a 74 77 6f 20 75 | 6e 64 65 72 73 63 6f 72 |th.two u|nderscor|
|00006210| 65 73 20 69 6e 20 66 72 | 6f 6e 74 2e 0a 0a 53 6f |es in fr|ont...So|
|00006220| 20 64 6f 6e 27 74 20 62 | 65 20 61 6c 61 72 6d 65 | don't b|e alarme|
|00006230| 64 20 69 66 20 73 6f 6d | 65 20 73 79 73 74 65 6d |d if som|e system|
|00006240| 20 6d 6f 6e 69 74 6f 72 | 20 74 65 6c 6c 73 20 79 | monitor| tells y|
|00006250| 6f 75 20 74 68 61 74 20 | 79 6f 75 72 20 70 72 6f |ou that |your pro|
|00006260| 67 72 61 6d 0a 6f 70 65 | 6e 65 64 20 64 6f 73 2e |gram.ope|ned dos.|
|00006270| 6c 69 62 72 61 72 79 20 | 74 77 69 63 65 20 2d 20 |library |twice - |
|00006280| 74 68 69 73 20 69 73 20 | 6e 6f 72 6d 61 6c 20 62 |this is |normal b|
|00006290| 65 68 61 76 69 6f 75 72 | 2c 20 6d 6f 73 74 20 6c |ehaviour|, most l|
|000062a0| 69 62 72 61 72 69 65 73 | 0a 64 6f 20 74 68 69 73 |ibraries|.do this|
|000062b0| 2e 0a 0a 4f 70 65 6e 69 | 6e 67 20 6c 69 62 72 61 |...Openi|ng libra|
|000062c0| 72 69 65 73 20 62 79 20 | 68 61 6e 64 20 77 6f 72 |ries by |hand wor|
|000062d0| 6b 73 20 65 78 61 63 74 | 6c 79 20 74 68 65 20 73 |ks exact|ly the s|
|000062e0| 61 6d 65 20 77 61 79 20 | 61 73 20 6f 6e 20 61 6e |ame way |as on an|
|000062f0| 79 20 6f 74 68 65 72 20 | 63 6f 6d 70 69 6c 65 72 |y other |compiler|
|00006300| 3a 0a 40 69 74 65 6d 69 | 7a 65 20 40 62 75 6c 6c |:.@itemi|ze @bull|
|00006310| 65 74 0a 40 69 74 65 6d | 20 0a 59 6f 75 20 64 65 |et.@item| .You de|
|00006320| 63 6c 61 72 65 20 74 68 | 65 20 6c 69 62 72 61 72 |clare th|e librar|
|00006330| 79 20 62 61 73 65 20 76 | 61 72 69 61 62 6c 65 20 |y base v|ariable |
|00006340| 73 6f 6d 65 77 68 65 72 | 65 20 67 6c 6f 62 61 6c |somewher|e global|
|00006350| 6c 79 3a 0a 0a 40 63 6f | 64 65 7b 73 74 72 75 63 |ly:..@co|de{struc|
|00006360| 74 20 44 6f 73 4c 69 62 | 72 61 72 79 20 2a 44 4f |t DosLib|rary *DO|
|00006370| 53 42 61 73 65 3d 4e 55 | 4c 4c 3b 7d 0a 0a 54 68 |SBase=NU|LL;}..Th|
|00006380| 65 20 69 6e 69 74 69 61 | 6c 69 7a 61 74 69 6f 6e |e initia|lization|
|00006390| 20 40 73 61 6d 70 7b 3d | 4e 55 4c 4c 7d 20 69 73 | @samp{=|NULL} is|
|000063a0| 20 6e 65 63 65 73 73 61 | 72 79 21 20 55 6e 69 6e | necessa|ry! Unin|
|000063b0| 69 74 69 61 6c 69 7a 65 | 64 20 76 61 72 69 61 62 |itialize|d variab|
|000063c0| 6c 65 73 0a 67 65 74 20 | 6f 76 65 72 77 72 69 74 |les.get |overwrit|
|000063d0| 74 65 6e 20 62 79 20 69 | 6e 69 74 69 61 6c 69 7a |ten by i|nitializ|
|000063e0| 65 64 20 6f 6e 65 73 20 | 69 6e 20 6f 74 68 65 72 |ed ones |in other|
|000063f0| 20 6f 62 6a 65 63 74 20 | 66 69 6c 65 73 20 2d 20 | object |files - |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.